0
のparamsが、私はそうのように一緒にネストされた2台のルータを持っていると仮定しなさい:親ルータ
var appRouter = express.Router();
var childRouter = express.Router();
appRouter.use('/:parentId/childpath', childRouter);
childRouter.get('/:childId', (req, res, next) => {
console.log(req.params); //only childId
// How do I get parentId ?
});
は、サブルータハンドラでparentId
を取得する方法はありますか?
と子ルータを作成します。 – rocketspacer