Timestamp Microservice Test Failing [Issue]

Tell us what’s happening:
My code is passing all other test except this
// running tests
An empty date parameter should return the current time in a JSON object with a unix key
An empty date parameter should return the current time in a JSON object with a utc key
// tests completed
I’ve been trying to work out the issue can’t find one.
Here’s my code:

app.get("/api/:timestamp", (req, res) => {
  let timestamp = req.params.timestamp;
  if (/\d{5,}/.test(timestamp)) {
timestamp = +timestamp;
  }
  let date = new Date(timestamp);
  if (date.toUTCString() === "Invalid Date") {
    res.json({ error: date.toUTCString() });
  } else {
return res.json({ unix: date.valueOf(), utc: date.toUTCString() });
  }
  app.get("/api/timestamp/", (req, res)=>{
    let date = new Date();
  res.json({unix: date.valueOf(), utc: date.toUTCString()});
});

Your project link(s)

solution: https://replit.com/@mallovelli/boilerplate-project-timestamp

Your browser information:

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

Challenge: Timestamp Microservice

Link to the challenge:

Open the browser console and run the tests and you’ll see errors like “GET /api 404” meaning the tests can’t reach that API endpoint.

Your code here and on repl.it are slightly different, but both have the second route function (app.get(...)) inside the first, so it’s never reached.

Thanks I’ve corrected that and all tests have passed.