Microservice TimeStamp error -- really unsure why --

Tell us what’s happening:
Describe your issue in detail here.
Here is my code:

app.get("/api/:date?",
  function (req, res) 
  {
  
  const datum = new Date()
  .toUTCString()
   const uni = Date.parse(datum);
  
  if (typeof datum !== 'string'){
      return res.json ({
        error: "Invalid Date"
      });
  }else
  res.json({unix: uni, utc: datum});
});

Here is the response I get:

{

* unix: 1625622429000,

* utc: "Wed, 07 Jul 2021 01:47:09 GMT"

}

I am really unsure where the error is?

Your project link(s)

solution: https://replit.com/@wendykkelly/boilerplate-project-timestamp-1
githubLink: https://replit.com/@wendykkelly/boilerplate-project-timestamp-1

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36

Challenge: Timestamp Microservice

Link to the challenge:

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

1 Like

I’m a little confused by some of your route paths and return values. I think you may have to read the requirements again.

Give the tests a look as well. It can help as you can see the URLs being used and the expected values.

Right - of course – sorry about that

That’s super helpful. Of course. Yes - tbh - part of the reason I decided to ask the question is that I literally realized that I likely was interpreting the requirements incorrectly.
Thx.
Reading the tests is an obvious, very good idea. I actually didn’t know that they were accessible. Thank you!

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