"APIs and Microservices Projects - Timestamp Microservice" tests fails

Hello everyone!

I have an issue on the first project challenge of APIs and Microservices Certification.

My app works fine, but when I put the Solution and the Github links, the whole tests fails.

Solution (Live App) link: https://safe-atoll-88215.herokuapp.com/

Github link: https://github.com/salinas38m/fcctimestamp

Thanks :heart:!!

Yeah, I was dealing with that also. Try installing the package “cors” from npm and adding the lines:

const cors = require('cors')
app.use(cors())

This was already in their template, which I didn’t use. Maybe it helps you, too.

It worked for me!! Tyvm ! :heart_decoration:

HI it didnt worked for me i pasted same glitch server line to both the places both text boxes
should i give github link only for second text box ??

here is the code
app.get("/api/timestamp/", (req, res) => {
res.json({ unix: Date.now(), utc: Date() });
});

app.get("/api/timestamp/:date_string", (req, res) => {
let dateString = req.params.date_string;

if (/\d{5,}/.test(dateString)) {
let dateInt = parseInt(dateString);
res.json({ unix: dateString, utc: new Date(dateInt).toUTCString() });
}else{
let dateObject = new Date(dateString);
if (dateObject.toString() === “Invalid Date”) {
res.json({“unix”: dateObject.getTime(), “utc” : dateObject.toString()});
} else {
res.json({ unix: dateObject.valueOf(), utc: dateObject.toUTCString() });
}
}
});

test case : It should return the expected error message for an invalid date is only failing

Yes, Github link only for second text box… On the first text box you must put the project link… I recommend you to host the project on Heroku, not Glitch