-
Notifications
You must be signed in to change notification settings - Fork 405
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
Nested routers middleware order? #156
Comments
Problem is here Update: following happens only when both subrouters are mounted to same path |
- Fixes ZijianHe#161, fixes ZijianHe#155, fixes ZijianHe#156. - Removes dependency on koa-compose.
I got the following code:
When I go on
/
route, I got the following debug messages:I would expect the opposite order, as I registered the router middleware first. Is it the expected behavior? If so, have you any clue to reverse this order?
My use case is quite standard: I got a main router in which I initialize a database connection through a middleware (setting it in a
this.dbClient
property). Then, my subrouters (one per API) initialize its model repository via another middleware, passing it thedbClient
service. The repository is then in an attribute to factorize code between all CRUD methods.The text was updated successfully, but these errors were encountered: