Basic Node and Express using the .envs

Basic Node and Express using the .envs


I am very confused at how express works. I don’t see any of the /json files, I don’t understand how the index.html and css page interact with the express code. For the challenge, the code is getting the The response of "/json" does not change according to MESSAGE_STYLE

/** 6) Use the .env file to configure the app */ app.get("/json", function(req, res){ if(process.env.MESSAGE_STYLE == "uppercase") res.json({"message": "HELLO JSON"}); else res.json({"message": "Hello json"}) });


Did you make the change in the .env file ?


yes I am just confused at how everything works. How does the index.html know to use the myapp or is it the myapp that calls on the index.html


I think this question does not make sense in Glitch. The website itself makes this connection, just like Codepen.


Hi I just got your code to work but i had to comment out (Blankout) section 5 in myapp.js eg.

/** 5) serve JSON on a specific route */
//app.get("/json", function(req, res) {
// res.json({“message”: “Hello json”});

as this section all so defines “message”.

you also have to define MESSAGE_STYLE in the .env file

Environment Config


hope this helps!