Back End Development and APIs Projects - Exercise Tracker

Tell us what’s happening:
Describe your issue in detail here.
Hello. I am working on this project and I can’t even pass one single test. I am fulfilling all the requirements. Registering the user and showing it in the manner required, registering the exercises against that user and showing it in the required manner. Can someone please check the code and tell me what I am doing wrong.
Your project link(s)

solution: boilerplate-project-exercisetracker - Replit

Your browser information:

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

Challenge: Back End Development and APIs Projects - Exercise Tracker

Link to the challenge:

Ok, the very first thing you should do is remove your database connection URI from your public code, as that is a security issue.
I’d immediately change your password for mongoDB too, because now everybody who looks at your code knows your password!
You should be storing such sensitive information in an environment variable. Ordinarily, you would do this in your .env file, but in replit you do this via your Secrets tab.

This is how your connection SHOULD look in your public code:

mongoose.connect(process.env.DB_URI, {
  useUnifiedTopology: true,
  useNewUrlParser: true,
1 Like

Most of the problem is likely here in your POST exercises route:

  // handling date
  if ( != false) {
    e_date = new Date(
  } else {
    e_date = new Date()

which checks if the provided date is false, but not if it is not provided in the request in a way compatible with the specification. I suggest logging the route inputs and all route outputs from the POST exercises and GET logs requests as well as the date before and during this code block while running the fCC tests to examine what is actually happening in your code.

I can’t even pass one test.

I could not get your project to run correctly after forking. At first it seemed to be the common CORS problem, but then I found you added that at the end of your code (it was actually timing out, which can manifest as a CORS problem). I tried some other things, but I could not even get it to serve the default view so it’s almost like you have a corrupted repl somehow. I would fork the boilerplate into a new project, check that it runs, and then begin copying/pasting your code into the new project piecewise, verifying that the app still runs at each step. Finally, you can fix the date problem and start trying to pass the tests.

1 Like