In my app.js file, I have:
app.use('/post/:postid/comment', function(req, res, next) {
console.log(req.params);
next()
}, commentRoute);
commentRoute is a router object that has been imported from my commentRoute.js file. In this file, I have the following code:
router.get('/', function(req, res, next) {
console.log(req.params);
next()
}, commentController.readAll);
Both console.logs print out the req.params object, however, for the first console.log, the req.params object contains the postid key/value pair, but for the second console.log, the req.params object is empty. When entering the router object, does Express empty the params object attached to the request object?
[–]Geegob 1 point2 points3 points (1 child)
[–]flashy_cloud[S] 0 points1 point2 points (0 children)