Hi fellow Campers! I’m having some trouble with the Exercise Tracker project in the APIs and Microservices section. I successfully completed the first 3 projects fairly easily, however I can’t figure out why I’m failing the fourth user story on this one.
The user story is:
" You can POST
to /api/users/:_id/exercises
with form data description
, duration
, and optionally date
. If no date is supplied, the current date will be used. The response returned will be the user object with the exercise fields added."
When manually viewing my api/users output, I can see the freecodecamp test entries including the logs that were added to the exercises array, so I know they are POSTing ok. Could it have something to do with the formatting of my response to the POST request?
My test output for the POST looks like the following:
{“username”:“test”,"_id":“8d56ea07e4ac6175807ed5f66279715d394d8885”,“exercises”:[{“description”:“test”,“duration”:“60”,“date”:“Tue Jun 15 2021”},{“description”:“test2”,“duration”:“30”,“date”:“Tue Jun 15 2021”}]}
I am returning the user object, including the list of exercises submitted. I included sample output from my api/users request as a json file in the root directory of my project (which you can access below). Has anyone completed this project recently or could anyone point me in the right direction on what I’m missing/doing wrong here? Thanks in advance for the help.
My project link
solution: https://replit.com/@robinroswell/boilerplate-project-exercisetracker
My browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Safari/537.36
Challenge: Exercise Tracker
Link to the challenge: