What is the best way of defining a route hierarchy so that I have a basic URL of /page/:id
, and then urls like /page/:id/delete
and /page/:id/edit
, without having to repeat the /page/:id bit in all the paths?
I've tried the following, but the id
param isn't available in the sub routes:
pageActions = express.Router!
pageActions.get "/delete", (request, response) ->
request.params.id #undefined
app.use "/page/:id", pageActions
I can't see any mention of this behaviour in the routing guide, but it seems like it would be useful to have all of the params available here, especially since having params in the route's "mount path" is allowed.