In my node JS express app I have defined routes with path having regex expressions in my app.js file. i.e
var tableRoute = require('./routes/tables');
app.use('/keyspaces/(regex to match param)/tables',tableRoute);
Then in my routes/tables.js file I have following handler defined for this route
router.get('/', function(req, res, next) {
// need to access url param here
});
Now clearly I cannot access my url param via req.params.xzy because here handler is defined for '/' not for '/keyspaces/:xzy/tables', is there any way I can access this url param here from original base url.
Aucun commentaire:
Enregistrer un commentaire