Should the example Excercise Tracker pass all the challenge tests?

This is the Exercise Tracker example from freeCodeCamp.
Is this project works as expected? Because I not able to test the User story 4.:
4. I can retrieve a full exercise log of any user by getting /api/exercise/log with a parameter of userId(_id). Return will be the user object with added array log and count (total exercise count).

Is it the rigth format to get log information? (BJaDFbkrB is a valid userId)

Edit: I found the right format:


Thank you. I could not get the example to work and was trying to figure out the endpoints.

I believe this project is broken in many ways. The first being the the clarity of the the challenge and the goal. Maybe that is the point? To figure out the goal & endpoints?

#2 the validation is broken; You can put in any link and it will pass. (makes debugging difficult)

#3 the “boiler-plate” is very bloated and was broken for me. it took me way too long (and frustration) to look into the provided code. Again, maybe that is the point. I’ve yet to ‘complete’ the challenge to my liking but will continue on the path I think it is suppose to go.

If you are stuck early on in this challenge & ‘remixing’ the Glitch project:

  1. if using the MONGO db from the lessons (the .env variable may be different); triple-check line 8 ‘mongoose.connect…’
  2. activate the ‘listener’ at the end of the code. It’s defined but never called.
  3. there are a pair of ‘middleware/error handlers’ provided… leave them at the bottom. I thought they were for the testing, but I was wrong and all routes defaulted to them. (another learning moment about the routes)

Here is a little extra front-end for the HTML I am using (add around line 30, after the last form.).
(this is what I am using to help complete the project! NOT VERIFIED WORKING)
Again, not sure if half this challenge is about ‘just making it work’ … but unfortunately any entry to the challenge passes.

          <form action="/api/exercise/users" method="get">
            <h3>List of Usernames & Unique IDs</h3>
            <p><code>GET /api/exercise/users</code></p>
            <input type="submit" value="Get Users">
          <form method="get">
            <h3>Get History by *ID*</h3>
            <p><code>GET /api/exercise/log?userId={userId}</code></p>
            <input id="uidlookup" type="text" name="userId" placeholder="**userID**">
            <input type="submit" value="Look Up by ID #" onclick="this.form.action='/api/exercise/log'">
1 Like

Thank you for helping make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.


For anyone else who finds this while struggling it is worth noting that the expect output for the /add path is :

const expected = {
description: ‘test’,
duration: 60,
date: ‘Mon Jan 01 1990’

and not what the example project gives which is has userId instead of _id.


Thanks very much for this. Dear freeCodeCamp team, you should update both the spec of the /api/exercise/add and the reference implementation to reflect the fact that ‘_id’ property is expected in the response and not the ‘userId’.

Hello, I have actually been stuck for days now, I left it just to come back to it.
Please can you do me solid and point me to a fix, thanks.