Tell us what’s happening:
Describe your issue in detail here.
All tests are passing so I don’t know why it doesn’t take me to the next challenge when submitting the solution. This is my code:
app.get('/api/:date', (req, res) => {
if (Date.parse(req.params.date)) {
console.log('case: date string')
res.json({ unix: Date.parse(req.params.date), utc: new Date(req.params.date).toUTCString() });
}
else if (Number.parseInt(req.params.date)) {
console.log('case: unix to date');
res.json({ unix: Number.parseInt(req.params.date), utc: new Date(Number.parseInt(req.params.date)).toUTCString() });
}
else {
res.json({ error: 'Invalid Date' });
}
});
app.get('/api', (req, res) => {
res.json({ unix: Date.now(), utc: new Date().toUTCString() });
});
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36
Challenge: Back End Development and APIs Projects - Timestamp Microservice
Link to the challenge: