steambap / koa-tree-router

high performance router for Koa

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Middleware after route

renataogarcia opened this issue · comments

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?

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.

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

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.