I'm stuck in Exercise Tracker project

Tell us what’s happening:
Hi guys, I’m trying to pass exercise tracker project, Although I test my code in the browser and it gives me correct results but when I tested it agiant free code camp it fails.
this is my code page: https://glitch.com/edit/#!/bahaa-mongoose-project. What did I miss here?

Your code so far

Your browser information:

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

Challenge: Exercise Tracker

Link to the challenge:

Hello~!

It looks like you created your own project on Glitch instead of remixing the FCC boilerplate. This means you’re missing essential code and files that allow the tests to run.

I create new app on glitch using the provided link of FCC, and didn’t change any thing just add my own code, but when I try to submit new user I get 404 error:

POST https://bow-icy-snickerdoodle.glitch.me/api/exercise/new-user 404

this is my glitch: https://glitch.com/edit/#!/bow-icy-snickerdoodle

image
This middleware is kicking in before any of your code.

I put it after app=express() but the main page gives me : not found message. and if I delete it and submit new user the page is hanged.
I found this error in glitch log:

(node:17213) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017

I have no .env file in my glitch app… is that the reason ???

Yup. Your .env file will hold your MongoDB URI, which is what allows your app to connect to your database.

Yes , I missed the .env file, I thought it was hidden as it contains FCC mongo test uri. I created .env file one and inserted my own uri variable.
Thank you.

1 Like