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

Is this challenge bugged? I did something very similar to the solution (just used res.json instead of res.send) and it didn’t work, then I copied the literal solution from the challenge hints, still doesn’t work. The first test passes, the second one doesn’t. When I go to domain.com/now i get the desired response.

Code:

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

Project invitation link: Invitation to collaborate on Replit - Replit

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:104.0) Gecko/20100101 Firefox/104.0

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

Link to the challenge:

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