-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
koa #15
Comments
Sure. PR welcomed. On Tuesday, April 14, 2015, Adrian Grigore [email protected] wrote:
Simple & Secure Bitcoin Wallet: https://www.coinbolt.com |
+1 for this, would love to see support for koa. |
@jprichardson I am working on a PR, and it seems to work, but I get these errors in the log.
I don't know this is because reload is waiting for the server to reboot or if there is an error in the websocket implementation with koa. Here is the entire log.
|
It should wait for the server to be running after a restart of the server before it tries to open a socket connection. It those cases where the error is printing is the server started? The code you are using would be helpful to help you debug |
@alallier So I got it working, but there is one problem. Koa makes use of |
The travis-ci tests try to build v4 of node, so I don't think that bumping it up to 7.6 is going to be a good idea. I'm only using 6.10.2 at the moment because that is the stable release, and that is what most people would be using |
Although, it installed on my version of node (6.10.2) so maybe you can use koa, just not the async. on https://www.npmjs.com/package/koa it says that you can use either the async function or the common function. Maybe this will work, just using the common function rather than the async. |
@alallier What are we doing about this? |
Sorry, I have turned around and started working in other languages. I do not think I will be able to complete this. |
@adriangrigore Do you think that you can do anything about this? |
Of course not, please go ahead and do anything you would like. I could also answer any questions you have. Most of the code you will need is here: 6c15d71 It would be a good idea to tell anyone using koa to put the middleware near the top in the README. |
I studied Koa to find it can process middleware just as Express processes middleware. The problem with reload, is it straps itself to Express and/or to Koa INSTEAD of offering a middleware plugin to allow others to strap it to there. I solved this in my fork by removing Express and offering a middleware function as seen here: https://github.com/AckerApple/reload/blob/master/lib/reload.js#L47 |
@Yamboy1 Sorry, didn't get the chance to even build anything with koa, was just experimenting at the time.I don't think I can be of much use. |
Here is a small wrapper to pretend koa-router is actually an Express server: function wrapRouterForReload(router) {
const wrappedRouter = function() { }
wrappedRouter.get = (route, callback) => {
router.get(route, (ctx) => {
callback(undefined, {
type: (type) => ctx.type = type,
send: (body) => ctx.body = body
});
});
}
return wrappedRouter;
} You can then do: const wrappedRouter = wrapRouterForReload(router);
reloader = reload(wrappedRouter); Obviously this may break with future reload versions. |
Consider adding support for koa?
The text was updated successfully, but these errors were encountered: