Chain Middleware to Create a Time Serve test failing when answer is correct

Hi,

I’m having the same issue posted here. I’m not able to pass the “The /now endpoint should have mounted middleware” test.

How did this one get solved?

I’ve tried with both provided solutions and the code below:

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

Edit: Code needs to be on myApp.js file and not on server.js

1 Like