Basic Node and Express - Use the .env File

Tell us what’s happening:
Describe your issue in detail here.
I do not understand the why my solution is not working at all.

https://chrome-breezy-art.glitch.me

Your project link(s)

solution: Glitch :・゚✧

Your browser information:

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

Challenge: Basic Node and Express - Use the .env File

Link to the challenge:

Click on the Terminal button at the bottom of Glitch project and then run the following commands (in order):

rm -rf node_modules
rm package-lock.json
enable-npm
npm install

After the npm install finishes, the app should restart. You can then close the Terminal and see the app in the preview and submit the url to pass the challenge as long as you have the correct environment variable and value in .env file.

1 Like

No. It still does not pass and I cannot see the preview because it does not load.

Glitch will spin down your server every 30 minutes I think. This means if you haven’t opened it in an hour or so, your app may take a long time to spin up.

There should be a debugger in Glitch you can open to check to see what the issue is.

You can also check out this solution from the Glitch forums.

1 Like

It still does not work. Nonetheless, I get the correct endpoint

https://boilerplate-express-2.aaronargotte.repl.co/json

Double check the capitalization

The response object should either be {"message": "Hello json"} or {"message": "HELLO JSON"} , depending on the MESSAGE_STYLE value.

1 Like

As @JeremyLT says, the following line is not one of those values for message.

var jsonResponse={"message":"hello json"};
1 Like