I am using an XMLHttpRequest like this:
xml.send(JSON.stringify({ingredients: this.state.ingredients}));
to send an object (this.state.ingredients) to the server. I'm pretty confident that it is being sent correctly, because in Chrome Dev Tools under Network tab the request payload looks right. However I've tried a bunch of different things on the server to grab that object and I can't get anything but undefined.
Currently it looks like this:
router.post('/recipes/:recipe_id/add', function(req, res) {
let ingredients = req.ingredients;
console.log(ingredients)
}
but I've also tried using JSON.parse among other attempts. What am I doing wrong here?
req?