Basic Node and Express - Get Query Parameter Input from the Client

Tell us what’s happening:
Hey, I’m totally stuck. Both locally and with replit I receive the correct results but tests are not passing at all :((
Task:

Code:

require('dotenv').config()
let express = require('express');
let app = express();
let bodyParser = require('body-parser');

app.listen(3001)
const absolutePath = __dirname + "/views/index.html"

app.get("/", function (req, res) {
    res.sendFile(absolutePath);
});

app.get("/name", function (req, res) {
    console.log(`${req.query.first} ${req.query.last}`)
    res.json({
        name: `${req.query.first} ${req.query.last}`
    });
});

app.use("/public", express.static(__dirname + "/public"));

module.exports = app;

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36

Challenge: Basic Node and Express - Get Query Parameter Input from the Client

Link to the challenge:

Your code is passing for me. As said, we really need to see the Replit.

1 Like

Thank you
Here it is:

https://replit.com/@bigOLara/boilerplate-express-1#myApp.js

Thank you
Here:
https://replit.com/@bigOLara/boilerplate-express-1#myApp.js

https://replit.com/@bigOLara/boilerplate-express-1#myApp.js

Sorry mates it just started working today, the only thing I did is removing comments…

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.