Basic Node and Express - Use the .env File problem

Tell us what’s happening:
Validation not working. It seems working correctly.

Your code so far
https://glitch.com/edit/#!/join/aec04589-609b-47ca-956b-846da07b8b97

Your browser information:

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

Challenge: undefined

Link to the challenge:
https://www.freecodecamp.org/learn/apis-and-microservices/basic-node-and-express/use-the-.env-file

You are not returning the correct words in the message. The instructions do not mention the words “Hello World”.

Hello webster.

In the lesson, it asks you to respond with {"message": "HELLO JSON"}, if the .env contains uppercase. You are responding with "HELLO WORLD". Is there any specific reason you thought to do this? Perhaps looking at the wrong lesson…

Hope this helps.

app.get("/json", function(req, res) {
  let response = {"message": "hello json"};
  if(process.env.MESSAGE_STYLE === "uppercase") {
    response.message = response.message.toUpperCase();
  }
  console.log(response, process.env.MESSAGE_STYLE)
  res.json(response);

})

It is not passing, but it satisfies task requirements.

Welcome, Nematjon.

This is not the exact message you are expected to respond with. I recommend you take a look at the previous challenge, for what you need to respond with.

If you have any more questions, please create your own topic with a link to your own code.

Cheers

1 Like

I appreciate your advice.
Sorry about that, I didn’t know, my bet.
Happy coding :+1:.