It seems that when I try to change the code any way it doesn’t pass the first 6 tests. I’ve been stuck on this for almost 2 weeks. I have no idea how I can fix it or what needs to be done. Any help is appreciated
I would suggest you install nodemon and change the start script to use it instead of node. That way when the server crashes it will not auto restart and you can actually read the crash log (not sure who on the Replit team thought auto restarting a server that crashes and wiping the log was a good idea but it is just dumb).
It is crashing with TypeError: Cannot read properties of null (reading 'toJSON')
Log out req.query in the /api/users/:_id/logs route. hint: :id is a parameter, i.e. req.params
As an aside, Line 63: toDateString is a method you have to call it ()
There still seems to be an error. Even when I do that. I ran nodemon and there is still errors. I had 7 of the tests pass but then whenever I make any slight changes it then fails everything.
I don’t see nodemon in your project and you have a syntax error (line 67). If I add nodemon and fix the syntax error I get a new error. If I fix that I get the same error from before, your parameter is not named userId. I’d suggest you log out req.params in your routes.
Log out req.body._id inside the /api/users/:_id/exercises route, or just req.body and look at it.
Log out req.params.userId inside the /api/users/:_id/logs route, or just req.params and look at it.