Basic Node and Express - Use the .env File

I am using Replit to complete the challenges. I am using the logic as mentioned below.

app.get(‘/json’, (req, res) => {
if(process.env[‘MESSAGE_STYLE’] === “uppercase”){
response = “Hello World”.toUpperCase();
}else{
response = “Hello World”;
}
res.send({“message” : response})
});

It is giving the following error:
The response of the endpoint /json should change according to the environment variable MESSAGE_STYLE

Can anyone help me in resolving the issue?

PS: I have created the env variable in lock section of the replit, as mentioned in the instruction set.

solution: boilerplate-express - Replit

Link to the challenge:

The response object’s message value must be the same as described in the problem - it looks like you have different message!

Ohh… Really feeling stupid.!!
Thanks :slight_smile:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.