-1
私はnext()
関数を呼び出すPOSTメソッドを持っていますが、res
プロパティにアクセスしようとするとundefined
と表示されます。私は印刷する場合:reqプロパティがnullです。
console.log(res)
を私は必要なプロパティを参照してくださいが、それらにアクセスしようとするいくつかの理由でundefined
を返すことができます。 これは私のコードです:
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
})
私が持っている:私のファイルの最上部にある
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
を。