【发布时间】:2017-03-01 17:55:46
【问题描述】:
我有两个端点:
按 ID 获取所有用户
http.get(API_URL + "users/" + id)
按用户名获取所有用户
http.get(API_URL + "users/" + username)
我可以在同一条路由上发送不同的参数吗:
router.get("/users/:id", async ctx => {
//ctx.request.param is id
//do something
});
router.get("/users/:username", async ctx => {
//ctx.request.param is username
//do something
});
感谢您的帮助!
【问题讨论】: