Nested routes in express, where a parent route includes a param Nested routes in express, where a parent route includes a param express express

Nested routes in express, where a parent route includes a param


There are two things I believe you might be confused about.

First, you shouldn't be using the get method for delete functions. Instead, you should be using the delete method. These are two of the HTTP shortcut methods that are mapped to what is sent in the request. This shows the full list of the shortcuts that are supported by ExpressJS and these all can be used by a router as well.

Second, if you are using a ExpressJS Router and you want to preserve parameters from the path where you are mounting the router you need to let ExpressJS know that with the mergeParams option:

var router = express.Router({mergeParams: true});


Use the Router's mergeParams option to inherit the route params from the parent: http://expressjs.com/4x/api.html#router