判断以下路由,将会响应哪一个路由
更多描述 代码见: 多匹配路由 - codesandbox
const app = new Koa();
const router = new Router();
router.get("/", (ctx, next) => {
ctx.body = "hello, world";
});
router.get("/api/users/10086", (ctx, next) => {
console.log(ctx.router);
ctx.body = {
userId: 10086,
direct: true,
};
});
router.get("/api/users/:userId", (ctx, next) => {
console.log(ctx.router);
ctx.body = {
userId: ctx.params.userId,
};
});
app.use(router.routes());
Issue 欢迎在 Gtihub Issue 中回答此问题: Issue 621
Author 回答者: shfshanyue
TODO