可以通过 body-parser 这个中间件来解决这个问题
npm i -S body-parser
在 app.js 中加入
const bodyParser = require('body-parser')
// 创建 express 应用
const app = express()
app.use(bodyParser.urlencoded({ extended: true }))
app.use(bodyParser.json())
可以通过 body-parser 这个中间件来解决这个问题
npm i -S body-parser
在 app.js 中加入
const bodyParser = require('body-parser')
// 创建 express 应用
const app = express()
app.use(bodyParser.urlencoded({ extended: true }))
app.use(bodyParser.json())
本文标题:如何使用body-parser解析post方法传递的参数
本文链接:https://www.haomeiwen.com/subject/nmxvlhtx.html
网友评论