当前位置:网站首页>node.express中req.body总是undefind解决
node.express中req.body总是undefind解决
2022-07-25 05:59:00 【Mr.Meng_95】
node.express中req.body总是undefind解决

因为express将body-parser分离了出来,所以需要手动添加进下面的内容即可
var path = require('path');
var bodyParser = require('body-parser');//用于req.body获取值的
app.use(bodyParser.json());
// 创建 application/x-www-form-urlencoded 编码解析
app.use(bodyParser.urlencoded({
extended: false }));
如果你传输的内容不是string类型时,你需要对上面的配置进行修改,否则也总是会得到undefined的结果
app.use(bodyParser.urlencoded({
extended: true}));
边栏推荐
- C100: smallest hevc visual IOT MCU
- Softing pnGate系列网关:将PROFIBUS总线集成到PROFINET网络
- sqlilabs less-29
- Detailed explanation of stepn chain game system development mode (Sports money making mode)
- 【每日一练】day(14)
- ABC 261.D - Flipping and Bonus ( DP )
- ERA5数据集说明
- 2021年ICPC陕西省赛热身赛 B.CODE(位运算)
- Run length test of R language: use the runs.test function to perform run length test on binary sequence data (check whether the sequence is random)
- 剑指 Offer 45. 把数组排成最小的数
猜你喜欢

VO, dto, do, Po distinction and use
![(15)[驱动开发]过写拷贝](/img/1c/68dfff5671add1fe91567e4df34135.png)
(15)[驱动开发]过写拷贝

【每日一练】day(14)

Unity accesses chartandgraph chart plug-in
![50: Chapter 5: develop admin management service: 3: develop [query whether the admin user name already exists, interface]; (this interface can only be called when logging in; so we have written an int](/img/1b/b8529b6f1d163a9e5d5dad2b78ce93.png)
50: Chapter 5: develop admin management service: 3: develop [query whether the admin user name already exists, interface]; (this interface can only be called when logging in; so we have written an int

(2022 Niuke multi school) D-Link with game glitch (SPFA)
![(16)[系统调用]追踪系统调用(3环)](/img/b0/011351361135fd9f8e2d0d31749f73.png)
(16)[系统调用]追踪系统调用(3环)
![(14) [driver development] configuration environment vs2019 + wdk10 write XP driver](/img/90/0d94d26be8128d77de65919763fda5.png)
(14) [driver development] configuration environment vs2019 + wdk10 write XP driver

Productivity tool in the new era -- flowus information flow comprehensive evaluation

Sword finger offer 45. arrange the array into the smallest number
随机推荐
Context must be a dict rater solution
新时代生产力工具——FlowUs 息流全方位评测
阻塞队列分析
ABC 261.D - Flipping and Bonus ( DP )
Unity Animator动画与状态机
出于数据安全考虑,荷兰教育部要求学校暂停使用 Chrome 浏览器
HTB-Beep
Please stop using system The currenttimemillis() statistical code is time-consuming, which is really too low!
Unity accesses chartandgraph chart plug-in
Amazoncaptcha bypasses Amazon IP verification code with 95% success rate
(2022 Niuke multi School II) l-link with level editor I (dynamic planning)
Summer summary 2
HTB-Granpa
Pdf snapshot artifact
Adaptation dynamics | in June, sequoiadb completed mutual certification with five products
(2022牛客多校)D-Link with Game Glitch(spfa)
Sword finger offer 05. replace spaces
Detailed explanation of stepn chain game system development mode (Sports money making mode)
An SQL execution process
Netease game Flink SQL platform practice