Back End Development and APIs Projects - Exercise tracker problems to post exercise

Hello colleagues:

I’m stuck on test #8

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

When I check where the problem it can be, I see things like the :_id value doesn’t appear in request’s body.

Strangely when I try it on my own if it works.

I know my solution could be better, but now I want to solve the issues that don’t let pass the tests.

I put down a link to my project. I hope someone can help me.

My solution

Thanks in advance.

Hey Gabit! I was reading your code and found the error in line 88

Screenshot 2023-01-11 at 13.17.23

Should be:

req.params['_id'] // you are checking params, not the body



Let me know if you have any other questions

1 Like

Cool! This solved the problem.

Why can I use the request body id? Is it wrong or doesn’t work on this specific test?

Fortunately now the project can pass all the tests.

Thank you very much.

No problem! Your syntax was somewhat wrong, and I believe the test wanted you to utilise the params method instead.

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