Tell us what’s happening:
My solution is not working. I think the code is correct and I’m using Replit. The test said:
The /now endpoint should have mounted middleware The
/now endpoint should return the current time.
And I don’t know what more I can do .
My code:
app.get('/now',(req,res,next)=> {
req.time = new Date().toString();
next();
}, (req,res)=> {
res.json({'time':req.time});
});
Your project link(s)
solution: boilerplate-express - Nix (beta) Repl - Replit
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36
Challenge: Basic Node and Express - Chain Middleware to Create a Time Server
Link to the challenge: