Issue
Last 2 tests are failling, even though they return exactly what is being asked.
It should handle an empty date parameter, and return the current time in unix format
It should handle an empty date parameter, and return the current time in UTC format
Code
app.get("/api/timestamp/", function(req,res) {
let date = new Date();
res.json({ unix: date.getTime(), utc: date.toUTCString() });
});
Browser
User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36.
Challenge
Timestamp Microservice (APIs and Microservices Projects)
Hi. thanks for the answer!
I’m calling app.get twice, one for the route: "/api/timestamp/" and another one for "/api/timestamp/:date_string", which is recommended in the challenge solution.
@RandellDawson
Link doesn’t work. I merged both routes into one anyways. Researched online and learnt about “optional parameters” (adding ?). Still doesn’t work.
Thanks. Already optimized code and works same as before, or at least it gives same output which is what the tester looks for i think, since it doesn’t have access to the code. I’m going to keep reading and testing.