steambap / koa-tree-router

high performance router for Koa
MIT License
138 stars 11 forks source link

Middleware after route #21

Open renataogarcia opened 2 years ago

renataogarcia commented 2 years ago

I'm trying to migrate a code that is working with @koa/router, but the last middlware doesn't get called when using koa-tree-router:

router.use(...) <= this works
router.get(...)
router.use(...) <= this is never called

Is that a known limitation?

steambap commented 2 years ago

This was added in #20 and I never thought it will be called after another get call. Also that PR did not include a TS definition. I will try to fix it during the weekend.

steambap commented 2 years ago

Yes, once you register a route, use will not append to existing route, that is the limitation.

renataogarcia commented 2 years ago

I see, thanks for the prompt response! I managed to work it around for now, but it might be useful to have this behaviour supported - if it's not too dificult to implement, since koa-router supports it, would make it easier to switch.