Sup guys. I need some help here please. I’m not understanding quite well why the challenge of building a timestamp project. It responds with: “A request to /api/timestamp/:date? with a valid date should return a JSON object with a unix key that is a Unix timestamp of the input date in milliseconds”
Though as you can check in my demo: https://boilerplate-project-timestamp.alejogarcia1.repl.co/ when I ask for a date in the url it returns me a json with unix key in ms.
Heres part of the code:
app.get("/api/timestamp/:date_str?", function(req, res){
const { date_str } = req.params;
console.log(date_str)
let date;
if (!date) {
date = new Date();
} else {
date = new Date(date_str)
}
return res.json({
unix: date.getTime(),
utc: date.toUTCString()
})
})
Challenge: Timestamp Microservice
Link to the challenge: