Back End Development and APIs Projects - Exercise Tracker

I have been stuck on the “Exercise Tracker” challenge for two days now and I am tired of it at this point.
I passed all the tests except for " The response returned from POST /api/users/:_id/exercises will be the user object with the exercise fields added." and I don’t unserstand why? I looked for people with the same problem but have found none.
If anybody can take a look at my code and help me find the issue, I’d be very grateful.

Your project link(s)

solution: boilerplate-project-exercisetracker - Node.js Repl - Replit

Your browser information:

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

Challenge: Back End Development and APIs Projects - Exercise Tracker

Link to the challenge:

Log your route inputs outputs for the POST user and exercise routes to get:

POST user
req.body: {"username":"fcc_test_16657985865"}
req.params: {}
req.query: {}
{
  username: 'fcc_test_16657985865',
  log: [],
  count: 0,
  _id: new ObjectId("634a11ba27a8857588bf2f63"),
  __v: 0
}
POST exercise
req.body: {"description":"test","duration":"60","date":"1990-01-01"}
req.params: {"_id":"634a11ba27a8857588bf2f63"}
req.query: {}
{
  _id: new ObjectId("634a11ba27a8857588bf2f63"),
  username: 'fcc_test_16657985865',
  __v: 1,
  date: 'Mon Jan 01 1990',
  description: 'test',
  duration: 60
}

Altering the return object for POST exercise to return

{
  username: 'fcc_test_16657985865',
  _id: '634a11ba27a8857588bf2f63',
  description: 'test',
  date: 'Mon Jan 01 1990',
  duration: 60
}

passes the test.

Always log the route inputs and outputs when debugging.

Thank you for the help, I altered it just like you said and it passed :smile: I can’t believe it was this easy lmao

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