Express.js req.body undefined

前端 未结 30 2765
半阙折子戏
半阙折子戏 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:43

    I solved it with:

    app.post('/', bodyParser.json(), (req, res) => {//we have req.body JSON
    });
    

提交回复
热议问题