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

Tell us what’s happening:
Describe your issue in detail here.
please can anything work just as expected on this camp, trying to chain a middleware to create a time server, usually the code should look like this right:
Your project link(s)

app.get('/now', (req, res, next) => {
  req.time = new Date().toString();
  next();
}, function(req, res) {
  res.json({ time: req.time })
});

it actually serves time, which happens to be different from the time on my pc, and then it can’t pass the test, what should i do differently on replit

solution: boilerplate-express - Replit

Your browser information:

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

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

Link to the challenge:

Something is wrong with your app. I forked it and the requests from FCC seem to be getting lost. Check out mine:

I added some console logging and the FCC requests never reach your router.

I think maybe somewhere along the way something got messed up in your replit. I just typed in basically the exact same code in a new file and it works fine. It looks like you changed some of the folder structure in the project and maybe it is affecting the tests in some way.

https://replit.com/@BrentonH/boilearplate-express-1#myApp.js

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