问题描述
这是我的 app.js
app.use('/v1/abc/',router);
然后是二级
router.use('/:primary_id/def',defServices);
最终服务水平
class defServices {
constructor() {
const router = new express.Router({ mergeParams: true });
router.get('/',this.func1);
router.get('/:pid',this.func2);
router.put('/',this.func3);
return router;
}
async func1(req,res) {
//code goes here
}
}
export default new defServices();
我的要求
GET http://localhost:3000/dev/v1/abc/48/def
我遇到第一个 GET 端点无法到达并获得 404 响应的问题,但第二个 GET 端点和第三个 PUT 端点工作正常。此外,这是在无服务器离线中实现的
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)