Basic Node and Express - Chain Middleware to Create a Time Server

Tell us what’s happening:

Describe your issue in detail here.

Your project link(s)

solution: https://boilerplate-express.shakthiraj577.repl.co/

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36

Challenge Information:

Basic Node and Express - Chain Middleware to Create a Time Server

This is my error : The /now endpoint should return the current time.

This is my code:

app.get(
‘/now’,
(req, res, next) => {
req.time = new Date().toLocaleString(‘en-US’, { timeZone: ‘Asia/Kolkata’ });
next();
},
(req, res) => {
res.json({ “time”: req.time });
}
)

You have defined the /now route twice, which can cause conflicts. The second definition of the /now route includes different middleware and a different handler, so it might override the previous definition.
link to your replit

Even with the single /now route iam getting the same error

1 Like

this one is passing the lesson .Well done …

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