Back End Development and APIs Projects - Exercise Tracker

Tell us what’s happening:
Describe your issue in detail here.
Keeps Failing on The response returned from POST /api/users/:_id/exercises will be the user object with the exercise fields added. Even though it is showing up right im lost.
Your project link(s)

solution:
https://free-code-camp-excersize-tracker-jv.onrender.com
Your browser information:

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

Challenge: Back End Development and APIs Projects - Exercise Tracker

Link to the challenge:

The response returned from POST /api/users/:_id/exercises will be the user object with the exercise fields added.

Your response:

{"response":{"username":"fcc_test_16857307854","description":"test","duration":60,"date":"Mon Jan 01 1990","_id":"647a35e237c62219e8ba84b7"}}

Your code:

let response = {
 username: existingUser.username,
  description: savedExersize.description,
  duration: savedExersize.duration,
  date: savedExersize.date.toDateString(),
  _id: existingUser._id
};

res.json({
  response
});

response is already an object so doing {response} creates a shorthand property (key is “response” and the value is whatever is inside response)

1 Like

Made the changes and the test continue to fail.

I originally had it in the response but broke it out for logging trying to figure out the issue…

Push your code so we can see it.

Okay for whatever reason it was not working locally but when pushed to my render site it started working fine thank you.

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