Tell us what’s happening:
I tried several different ways that solve correctly the exercise, seems to be a problem out of my hand that comes when correcting the exercise.
First try:
app.route(‘/name’).get(function(req, res) {
console.log(req.query);
var { first: firstName, last: lastName } = req.query;
res.json({ name: ‘${firstName} ${lastName}’});
})
Second try:
app.route(‘/name’).get(function(req, res) {
console.log(req.query);
res.json({ name: ‘${req.query.first} ${req.query.last}’})
})
Third try:
app.route(“/name”, function(req, res) {
var { first: firstName, last: lastName } = req.query;
res.json({ name: ‘${firstName} ${lastName}’})
})
And many others… That didn’t work no matter if console was already showing the expected results.
Please let me know how can I continue to advance with the course.
Thanks
Your project link(s)
solution: boilerplate-express (1) - Replit
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36
Challenge: Basic Node and Express - Get Query Parameter Input from the Client
Link to the challenge: