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: boilerplate-express (1) - Replit

Your browser information:

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

Challenge Information:

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

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

i keep getting this message

// running tests The

/now

endpoint should return the current time. // tests completed

your PC timezone is not the same as your browser.

The solutions is to set your timezone and time to automatic in your PC settings.

2 Likes

i have lost 3 hours just for that :sweat_smile: :sweat_smile: Thanks :blush:

1 Like

I used the same solution a set the notebook timezone to automatic and I still got “endpoint should return the current time.” message. When I used the solution link in my browser I got the correct response. {“time”:“Thu Mar 21 2024 22:28:19 GMT+0000 (Coordinated Universal Time)”}