1. 安装body-parser
    npm i body-parser --save

  2. 配置
    // application/json
    let jsonParser = bodyParser.json()
    // application/x-www-form-urlencoded
    let urlencodeParser = bodyParser.urlencoded({extended:false})

根据请求的类型选择在
app.post("/register",urlencodeParser/*对应的配置*/,router.register)nodejs body-parser使用方法
3. 后台将接受到的文件存在app.get方法的回调函数中的request.body之中。

nodejs body-parser使用方法

相关文章:

  • 2021-09-14
  • 2022-12-23
  • 2022-12-23
  • 2021-07-19
  • 2021-11-27
  • 2021-11-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案