一、下载 body-parser 模块 : npm install body-parser express
二、require body-parser 模块(引入),并用一个变量接收(此处栗子变量为 bodyparser)npm
三、将 bodyparser 注册为中间件app
const express = require('express') // 在此处 require body-parser 模块
const bodyparser = require('body-parser') const app = express() app.listen(3001, () => console.log('app is running...')) // 在此处 use 这个 bodyparser 中间件
app.use(bodyparser.urlencoded({ extended: false }))