Beta "Get Data from POST Requests" lesson in node.js tutorial

Beta "Get Data from POST Requests" lesson in node.js tutorial
0.0 0

#1

Hi, I’m a bit lost on the “Get Data from POST Requests” part of the Node.js tutorial from the beta.

Here it is https://beta.freecodecamp.org/en/challenges/basic-node-and-express/get-data-from-post-requests.First I tried doing something like this

let ha = function(req, res) {
  let name = req.query.first + ' ' + req.query.last;
  res.json({'name': name});
}
app.route('/name').get(ha).post(ha);

like in part 10, but it didn’t work. Then I tried this

app.post('/name', (req, res) => {
  let name = req.body.first + ' ' + req.body.last;
  res.json({'name': name});
});

and that doesn’t work either. I’m not sure what to do here. Can someone help me??