I have a POST method that calls the next() function but when I try to access the res properties I get undefined. If I print:
console.log(res)
I can see the properties that I need but for some reason trying to access them returns undefined. This is my code:
app.post('/login', [function(req, res, next){
req.ID = "hello, world"
next();
}, function(req, res){
console.log(res) //I can see res.ID I am trying to access in the log
console.log(res.ID) //undefined
})
I have:
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
at the very top of my file.
via foobar5512
No comments:
Post a Comment