Back End Development and APIs Projects - Exercise Tracker

Tell us what’s happening:
Describe your issue in detail here.
My tests give error 404
Your project link(s)

solution: boilerplate-project-exercisetracker - Replit

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 - Exercise Tracker

Link to the challenge:

First thing I notice is that this route has a typo:

app.post(`/api/users:_id/exercises`, function(req, res){

You pass another bunch of tests if you fix that.

Then the only tests which are failing are in the log which you return from
GET /api/users/:_id/logs.

I’d console.log it to see what’s missing/incorrect.

1 Like

I ran the code and there doesn’t seem to be anything wrong, but it doesn’t complete the exercise.

Just before you return the user object in the res.json, console.log it. Then you might see what’s missing/incorrect.

the test asks to return a String, but in the console log the date is returning the string referring to the date and even so it does not pass

I’ve spotted a number of issues with your routes and handling of dates.

What is this for instance?

const date = req.body.date ? `Mon Jan 01 1990` : `Fou Mar 03 2023`

I’ll try to have a more detailed look later - I’m at work right now.

[quote=“igorgetmeabrain, post:7, topic:596780”]
is an model IF

const date = req.body.date ? `Mon Jan 01 1990` : `Fou Mar 03 2023`

Yes, and what’s more, the project instructions specify that - in the absence of a user-supplied date - the current date should be used instead.

I’d recommend reading up a bit on the JS Date object, so that you can understand how to take the user-supplied date and return it in the format required by the project.

There are many resources on this but this one looks useful to me: Date and time

1 Like

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