Chain Middleware to Create a Time Server

I am seriously stuck here, I tried many things, and also ask for help but I cannot understood where I am going wrong!

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

→ This is my code so far, I am passing 1 test, but in second test I am failing. By the way i am using replit.
→ and I have tried the url with /now route, and also it is giving me this result :

{"time":"Mon Feb 12 2024 08:38:13 GMT+0000 (Coordinated Universal Time)"}

Now, can anyone help me with this. ???

https://www.freecodecamp.org/learn/back-end-development-and-apis/basic-node-and-express/chain-middleware-to-create-a-time-server

Your code looks fine, and it passes the test for me. :white_check_mark:

Do you have more code in your file before this function? Try commenting out everything except this function. Maybe there is some kind of millisecond delay that messes up the test.

If that doesn’t work, can you link to your replit?

Thanks for answering.

I tried commenting out everything. But still doesn’t worked.

here’s my replit link : boilerplate-express - Replit

take a look and please tell me if you find anything. :slight_smile:

If I fork it and run it and submit the new URL it gives me, it passes everything. I made no changes

https://bcc04312-ed97-4ecf-b9cd-2e5280b44316-00-3eqwl5w7sq1t4.worf.replit.dev/

Try refreshing the page? And just to confirm the site is running, live, when you submit? (I’m not able to test your screenshot link since I ain’t typing all that in :sweat_smile:)

Maybe try what I did and just create a new fork? Maybe it will shake something loose.

Yup, tried all the things that you said and still can’t figure it out. also tried that hint section from it.

still failure, wonder what should I do now?

oh btw, my submitting link is this : https://a82036d7-49c4-46f6-958d-4307f8e3b63e-00-17p2yejz6hwvw.sisko.replit.dev/

and my replit link : boilerplate-express - Replit

I completed other task…

Can you try forking it? I think that’s the same link you sent originally. Try to create a new copy maybe something magic will happen.

Make sure your OS system clock is synced correctly. Force an update to it (depends on the OS which I can’t see from your post).

I am working in windows11

And what is OS system clock ?

Right-click the clock, select “Adjust date/time”, and on the settings page click the “Sync now” button.

Or

Start > Settings > Time and Language > Date and Time


Also, make sure your time zone is correct.