I'm trying to send data from React to Node js. I'm using Ajax. I don't get data by Node.js
This is my code on React :
let id = item.id
$.ajax({
url: '/postid',
type: 'POST',
data: id
});
console.log('React id : ' + id);
And my code on Node.js
app.post('/postid', function (req, res) {
console.log("node js ok");
var getId = req.body.id; // here, i don't get the id value
console.log("id Node js : " + getId);
});
Do you have an idea ? Thank you
body-parserat node js server?