get 方法
axios 传入参数 (params)
axios.get(users/demo', {
params:{
username:'admin',
password:'123456'
}
}
express 接收参数 (query)
router.get('/demo', (req, res,next) => {
let param = req.query
...
});
post 方法
axios 传入参数
axios.get(users/demo', {
username:'admin',
password:'123456'
}
express 接收参数 (body)
router.post('/demo', (req, res,next) => {
let param = req.body
...
});
delete 方法
axios 传入参数 (data)
axios.get(users/demo', {
data:{
username:'admin',
password:'123456'
}
}
express 接收参数 (body)
router.post('/demo', (req, res,next) => {
let param = req.body
...
});
axios传参 express接收参数