解决express服务器接收post请求报错:“req.body==> undefined“
现象如下:
解决办法:在代码中加入body-parser解析
const bodyParser = require("body-parser");
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
参考:
How to fix "req.body undefined" in Express.js