Basic Node and Express - Use the .env File - not working

Tell us what’s happening:
I have written below code but the test case is not passing.
The response of the endpoint

/json

should change according to the environment variable

MESSAGE_STYLE

Your code so far
app.get(’/json’, (req, res) => {
var message = process.env.MESSAGE_STYLE === “uppercase” ? “HELLO JSON” : “Hello Json”;
res.json({message});
});

Your browser information:

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

Challenge: Use the .env File

Link to the challenge:

It should be Hello json not Hello Json

1 Like