Tell us what’s happening:
Getting an error message:
Cannot read properties of undefined (reading ‘first’)
Console in browser shows:
POST https://fcc-boilerplate-express-2.rigo205.repl.co/name 500
Your code so far
app.post(“/name”, function(req, res) {
// Handle the data in the request
var string = req.body.first + " " + req.body.last;
res.json({ name: string });
});
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36
Challenge: Basic Node and Express - Get Data from POST Requests
Link to the challenge: