Back End Development and APIs Projects - Exercise Tracker - BPSLss2yNnvDL1Kmw9GG-

GET /api/users/:_id/logs

always giving errors on freecodecamp’s test despite working fine on server.

Your project link(s)

githubLink: GitHub - Asad13/fcc-backend-project-exercisetracker: An exercise tracker microservice
solution: https://enthousiaste-livre-94946.herokuapp.com

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36

Challenge: Back End Development and APIs Projects - Exercise Tracker

Link to the challenge:

Check the responses in the network tab in the browser dev tools when you submit.

  • All the log arrays are empty in the response for the requests that do not use to/from/limit.

  • All the POST requests to /api/users/:_id/exercises where the payload doesn’t include a date are returning Error (not sure why the tests are passing though).

I can’t look at the code right now.

That’s not the case. If the user has exercises then the log array is not empty. And even if the log array is empty there would be a count property with 0 value. You can check following the link below:
https://enthousiaste-livre-94946.herokuapp.com/api/users/62d380768b03fe00168086c2/logs

It’s solved. It’s due to the date fcc sometimes doesn’t send in testing as it is optional. I had used default date in schema but forgot to handle it in API request when someone submits the exercise form.

It’s solved. It’s due to the date fcc sometimes doesn’t send in testing as it is optional. I had used default date in schema but forgot to handle it in API request when someone submits the exercise form.

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