配置

// 通过bodyParser获取req.body
const bodyParser = require('body-parser')
//
devServer: {
before(app) {
app.use(bodyParser.json())
mockArr.forEach((mock) => {
if (mock.method === 'get') {
app.get(mock.url, function (req, res) {
const params = req.body
console.log('params:', params)
res.json(mock.data);
});
} else {
app.post(mock.url, function (req, res) {
const params = req.body
console.log('params:', params)
res.json(mock.data);
});
}
});
},
},