webpack中使用devServer接收POST请求传来的值

webpack中使用devServer接收POST请求传来的值

const bodyParser = require('body-parser')
...
module.exports = {
     
    devServer: (app) => {
     
        app.use(bodyParser.json())
        app.post('/api/getList', (req, res) => {
     
	        console.log(req.body)
	        res.send({
     
	        	code: '000',
	        	msg: "请求成功"
	        })
        })
    }
}

你可能感兴趣的:(vue,vue)