出现 参数是 undefined or null 

一、检查是否安装 body-parser

      server.js中是否引入 

app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
 
二、如果上面没有问题,请注意是是否 中间件顺序是否有问题
 
 错误:
app.use('/user',router);
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
 
正确:
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use('/user',router);
 
 

相关文章:

  • 2021-11-06
  • 2022-12-23
  • 2021-07-22
  • 2021-09-02
  • 2021-10-17
  • 2022-12-23
  • 2022-12-23
  • 2021-09-11
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-06
  • 2022-12-23
  • 2021-09-17
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案