Having worked extensively with Express 4, I recently attempted to implement a namespaced route with a parameter. This would involve routes like:
/:username/shows
/:username/shows/:showname/episodes
I figured this scenario was ideal for express namespacing, so I set it up as follows:
Router = require("express").Router;
userRouter = Router();
userRouter.route("/shows").get(function(req,res){ ... });
app.use("/:param", userRouter);
The page loaded correctly at /:username/shows
, but when checking the req.params
object, I noticed that the key for username
was empty. Would appreciate any insights on where I can access these parameters?