我的一个路由中req.body是拿得到前端是数据的,但是其他路由bodyParser全部都是undefined,有谁可以告诉我问题在哪吗?
回复 (2)
K
bodyParser 有没有放在前面?
G
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.
参与回复
登录后即可参与回复。登录