-1

I'm working on a rest api in which I'm using middlewares and trying to set nested routes.

i got something like this:

router.use('/route/:param/day, router1);
router.use('/route/:param/year, router2);


router1.get('/:day/:month/:year', function(req, res){
...
});

The parameter refers to the type of research that I have to do into my database and I need to know the kind and the date to do the proper request. the thing is, I would like to get the param from the parent into the nested one, I set mergeParams: true but I cannot get it, it's always undefined.

the
  • 21,007
  • 11
  • 68
  • 101
Tommy
  • 21
  • 2

1 Answers1

-1

check your express version. mergeParams available from express 4.5.0+. reference:http://expressjs.com/api.html