Closed cevio closed 6 years ago
Fix the merge relationship between prefix and path, so that path-to-regexp can correctly parse the regular expression.
prefix
path
path-to-regexp
I found the bug:
const Koa = require('koa'); const Router = require('koa-router'); const app = new Koa(); const router = new Router(); const test = new Router(); test.get('/test', async (ctx, next) => { ctx.body = 'hello world'; }); router.use('/abc', test.routes(), test.allowedMethods()); app.use(router.routes()); app.use(router.allowedMethods()); app.listen(9000);
When i view '/abc/test' , the result is '404';
I fixed it.
Thanks!
Fix the merge relationship between
prefix
andpath
, so thatpath-to-regexp
can correctly parse the regular expression.I found the bug:
When i view '/abc/test' , the result is '404';
I fixed it.
Thanks!