关于bodyparser req.body为空的问题,这是什么bug吗,高手请指教
我的一个路由中req.body是拿得到前端是数据的,但是其他路由bodyParser全部都是undefined,有谁可以告诉我问题在哪吗?
2 回复
bodyParser 有没有放在前面?
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }))
extended含义: The extended option allows to choose between parsing the URL-encoded data with the querystring library (when false) or the qs library (when true). The “extended” syntax allows for rich objects and arrays to be encoded into the URL-encoded format, allowing for a JSON-like experience with URL-encoded. For more information, please see the qs library.