Express.js req.body undefined

前端 未结 30 2499
半阙折子戏
半阙折子戏 2020-11-22 12:02

I have this as configuration of my Express server

app.use(app.router); 
app.use(express.cookieParser());
app.use(express.session({ secret: \"keyboard cat\" }         


        
30条回答
  •  情歌与酒
    2020-11-22 12:38

    The Content-Type in request header is really important, especially when you post the data from curl or any other tools.

    Make sure you're using some thing like application/x-www-form-urlencoded, application/json or others, it depends on your post data. Leave this field empty will confuse Express.

提交回复
热议问题