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

Tell us what’s happening:
Describe your issue in detail here.
The chain method seems to work properly but i am constantly getting error as below.
// running tests
The /now endpoint should have mounted middleware
The /now endpoint should return the current time.
// tests completed
// console output
[Error: Not found]
[Error: Not found]

Below is 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: https://boilerplate-npm--ashishmishra96.repl.co

Your browser information:

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

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

Link to the challenge:

Below is the output on endpoint /now

{“time”:“Tue Sep 19 2023 06:32:48 GMT+0000 (Coordinated Universal Time)”}

FYI: I am from india but it still shows GMT time can it be a issue?

Are you sure you are using the right link? https://boilerplate-npm--ashishmishra96.repl.co/now is not showing for me the date. Could you link to your code on replit?

https://boilerplate-express--ashishmishra96.repl.co/now

This is the correct link i have used this to submit

My mistake
I was using the wrong link

1 Like