[Vuejs]-Axios post to nodejs server but nodejs cannot get data

0👍

axios.post('http://localhost:8081/users', {foo: "Bar"})
 .then((response)=> {
      console.log(response.data) // must be show "Bar"
  })
  .catch((error)=> {
      console.log(error)
  })

app.post('/users', (req, res) => {
  console.log(req.body.foo) // must be show "Bar"
  res.send(req.body.foo)
})

Leave a comment