My fourth project on APIs and Microservices Projects

Tell us what’s happening:
It just says (Test Timed Out) what should i do

Your code so far!/lucky-lavender-scallion?path=server.js%3A1%3A0

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Firefox/78.0.

Challenge: Exercise Tracker

Link to the challenge:

There’s no response when attempting any of the User stories. My guess would be something wrong with your database connection.
Go to Tools > Logs on Glitch
Then try doing the User Stories on the challenge page and see what errors come up.

I dont understand :confused:

When I try to create a new user using the form (first test), the browser just stays loading. So freeCodeCamp is not getting a response, which is why the test are failing.

Looking at your code, it seems like you have the correct code written out to give a response, which is not being returned. So I assume it’s an issue with the database connection, since something is causing it to freeze up.

You can use the console log in Glitch, as shown in this challenge to look for any error messages:

So its the database connection?

I think so. I can’t check the logs since I would need to remix the project to do so.
Even if I do that, I can’t connect to your database without credentials, so it won’t work for me regardless.

I dont know how to change it I tried google search :confused: Plz tell me The Database i mean

First, setup your MongoDB Database:

  1. Go to MongoDB Atlas and Create an Account
  2. Create a Free Shared Cluster, customizing the location and name if you wish
  3. Wait for the cluster to be created → Usually about 5 minutes
  4. Go to Database Access, create a new user with a password (copy and paste this somewhere) and give the user read/write previlages
  5. Go to Clusters, Click Collection, Click Add my Own Data, and Create a Database and Collection, note down the database name
  6. Go to Network Access, Add IP Address, and add your IP address here, or allow access from anywhere
  7. Go to Clusters, Connect, Choose ‘Connect with App’, Copy the URI

Then, setup the project on Glitch:

  1. Update mongodb and mongoose to the latest versions in package.json, so they look something like this:

  2. Store the password in an environment variable in Glitch like this:

  1. Create a uri string variable in your code like this, filling in your details:

let uri = 'mongodb+srv://<USERNAME>:' + process.env.PW + '<DATABASE>?retryWrites=true&w=majority'

The password will be added from the environment variables, but replace the username and database name

  1. Replace the connect line in the server.js:

With this:

mongoose.connect(uri, { useNewUrlParser: true, useUnifiedTopology: true });

That’s how I set up my database connection.