Express.js req.body undefined

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

    Express 4, has build-in body parser. No need to install separate body-parser. So below will work:

    export const app = express();
    app.use(express.json());
    

提交回复
热议问题