-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
mounting into an express app #846
Comments
You probably want I'm not quite sure what |
I think the docs for you're looking at would assume that Koa would be used to handle a subdirectory like |
Huh. The |
@nickb1080 Yep, I figured so. I don't think you want |
Wait, I just realized you're going to get a 404 response from Koa of course. I'll see how that can be prevented. |
It looks like |
Yeah I that'll work for avoiding the automatic 404 but I still see no way of calling the I'm experimenting with a hacky workaround that subclasses the Koa application class. It's sort of a pain because the |
@nickb1080 Ooh, that's a tricky one, I thought |
Without this, there's no way of hooking into after Koa is done with the response. This can be extremely important if used with `ctx.respond = false`, as in koajs#846 (see there for use case). While this is technically a breaking change, I don't expect it to break anything.
In case you didn't get a notification, I opened #847 for this. |
@PlasmaPower has a PR open. if anyone else would like to put in their 2 cents, that would be great! /cc @nickb1080 |
Wow, that would solve a lot of integration issues and smoothen transitions to Koa. |
The test case for PR #847 appears to address all my concerns! |
I'm glad! @jonathanong anything holding it up? The name of the variable might not be great, but it's fine IMO. I have tests for it too. |
Maybe just |
@fl0w Hmm, maybe. The difference of course is that it doesn't accept |
This is resolved in e6539e1 |
I'm exploring migrating a large production Express app to koa v2 (so all of this applies to the promise API of v2). The koajs.com docs say for
app.callback()
:However, it seems like you must mount a koa app at the "bottom" of your Express app since koa will never call
next()
to yield control back to express (like in the 404 case). I can't see an obvious work around for this currently. If the function returned bycallback
returned the promise, I think something like the following would work:Perhaps somewhat related -- what's the use case for setting
ctx.respond
tofalse
?The text was updated successfully, but these errors were encountered: