Tell us what’s happening:

Basic Node and Express - Use the .env File

This is where I got stuck, I don’t know what’s wrong in my code but when I paste the link to the solution it keeps appearing this- // running tests The response of the endpoint


should change according to the environment variable


// tests completed

Your code so far
Here is the code -

  if (process.env.MESSAGE_STYLE==="uppercase") {
  res.json({"message":"HELLO JSON"});
} else {
  res.json({"message":"hello json"});
})/** 5) serve JSON on a speci       

The link to the code has been mentioned above.

Please help.

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: Use the .env File

Link to the challenge:

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

Please use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks are not single quotes.


In the else block, try returning {"message":"Hello json"} (capital H in hello).

I have tried that but it didn’t work.

Not really sure what is going on I get a CORS block with your project. But if I remix it and add the variable value it works. Not sure but it might be the name of the project (trailing - in the name maybe).

Try renaming the project first. Click the top-left button and in the input at the top, you can write a new name. If that doesn’t work, try remixing it. Again click the top left button and then click “Remix Project”.