-
-
Notifications
You must be signed in to change notification settings - Fork 22.9k
Closed
Description
I was using router.param() method to run middleware in all the routes which has ':department_id'.
for example:
In my app, the route will be app.use('/department/:department_id/class',departmentRoutes);
In my departmentRoutes, child route will be router.get('/:id', ...controller);
I have use { mergeParams : true } to include all the params in the router to consider.. but when i use router.param(':department_id', ); the middleware gets skipped as it considers the ':department_id' as no parameter.
But the when we use router.param('id',); the middleware logic gets executed perfectly!!
kindly clear me of the doubt that, will the router.param() consider the params from the parent or app.
Reactions are currently unavailable