You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically it works correctly. But later if you wanna list them all you can't get correct and actual routes.
If you have, for example, one router and use .middleware multiple times with different prefixes all will work, but you can't get all available routes - they works, but you can list them for example, after the server is started (for example list them from the app.listen(port, fn) callback)
It will print only 14 routes, only these that are on / prefix, but not the others. They will work. If you access them through web. You will have 42 actual and working routes, but it will output only 14 of them.
So if you wanna do the trick correctly you should do 3 different routers and use the .extend method.
letrouter2=Router({prefix: '/api/v1'})letrouter3=Router({prefix: '/foo/api/v3'})// add `router`'s routes on `router2`router2.extend(router)// add `router`'s routes on `router3`router3.extend(router)// add the three routers on koa serverapp.use(router.middleware())app.use(router2.middleware())app.use(router3.middleware())leti=1router.routes.forEach((route)=>console.log(i++,route.path))router2.routes.forEach((route)=>console.log(i++,route.path))router3.routes.forEach((route)=>console.log(i++,route.path))
The text was updated successfully, but these errors were encountered:
It was working, basically. But leads to more shits than goods. Explicit is better.
BREAKING CHANGE: `.middleware` method no more accepts arguments - use `.legacyMiddleware` for
legacy; create a new router for another prefix then use `.extend` method for grouping the router.
Closes#9 and tunnckoCore/koa-rest-router#8
Basically it works correctly. But later if you wanna list them all you can't get correct and actual routes.
If you have, for example, one router and use
.middleware
multiple times with different prefixes all will work, but you can't get all available routes - they works, but you can list them for example, after the server is started (for example list them from theapp.listen(port, fn)
callback)It will print only 14 routes, only these that are on
/
prefix, but not the others. They will work. If you access them through web. You will have 42 actual and working routes, but it will output only 14 of them.So if you wanna do the trick correctly you should do 3 different routers and use the
.extend
method.The text was updated successfully, but these errors were encountered: