Exercise Tracker App Help! (FreeCodeCamp)


I am going through FreeCodeCamp’s curriculum and I can’t seem to get an exercise right. Can’t post the link to the exercise since I’m a new user. Google ‘FreeCodeCamp Exercise Tracker App’ for more info.

The tests I am failing are:

  • I can add an exercise to any user by posting form data userId(_id), description, duration, and optionally date to /api/exercise/add. If no date supplied it will use current date. App will return the user object with the exercise fields added.

  • I can retrieve a full exercise log of any user by getting /api/exercise/log with a parameter of userId(_id). App will return the user object with added array log and count (total exercise count).

However, I can both apparently update users (with new exercises) and retrieve them from the database.

I think the error is in the lines 75-175 of my server.js file.

My glitch app: https://seed-jet-dugong.glitch.me

My glitch code: https://glitch.com/edit/#!/seed-jet-dugong

Can some expert in node.js / javascript spot any clear mistake?

Sorry in advance if my code is not the neatest…

Thank you!

I think you need a debugger rather than an expert.

However, I would suggest you to limit your logic (75-175 lines) to a minimal, complete, verifiable example, so that we can help you rapidly and efficiently.
And, if that’s an uncaughtException, then you could try...catch

Thank you for your answer. The thing is that I am not getting any errors. I am simply not passing certain written tests. I have no feedback other than I didn’t pass them. I can’t see any error in the console when I run the tests.

Hi Gerard, I’m failing the exact same tests. I even looked into the example app source code to try to figure out the error.
I found the test source code after trying everything that came into my mind to fix it, I’m sure I am missing something, anyway, you can see the tests here:

I’m currently having the same issue as you guys. Did any of you ever find a solution?