axios传参 express接收参数

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接收参数

上一篇:Android studio 连接真机


下一篇:苹果手机安装未上线App操作流程-实际公司-Dotest董浩