1
axios.post(url, { data : obj})

I attend a interview and interviewer say question post from axios

Or Assayag
  • 5,662
  • 13
  • 57
  • 93
dalpat raj
  • 11
  • 2

1 Answers1

0
const URL = "http://localhost:5500/register";

let data = {
 name: 'dalpat',
 email: 'test@gmail.com'
};

axios.post(URL, {
data: data;
})

// Routes
app.post("/register", (req, res){
  const {name, email} = req.body.data;
  res.send({name: name})
})
dalpat raj
  • 11
  • 2