Tell us what’s happening:
I can’t seem to pass the test, or look for any relevant similar topics for my current problem, so I’m guessing it’s my current understanding of the topic.
Navigating to the /name?firstname=etc&lastname=etc URL is displaying what seems to be the correct functionality, a json object of: { ‘name’ : ‘first last’ } that is described in the challenge yet it doesn’t pass the test? What am I doing wrong?
Your code so far
app.get('/name', (req, res) => {
let first = req.query.firstname;
let last = req.query.lastname;
let jsonObj = { name: `${first} ${last}` };
res.send(jsonObj);
});
// I also tried this, as it was in the TIP section as it makes way for the upcoming POST challenges
/**
app.route('/name').get((req, res) => {
let first = req.query.firstname;
let last = req.query.lastname;
let jsonObj = { name: `${first} ${last}` };
res.send(jsonObj);
}).post();
**/
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/apis-and-microservices/basic-node-and-express/get-query-parameter-input-from-the-client