Use the .env file lesson 6

Tell us what’s happening:
I’m trying to solve the lesson 6 in the “Basic node express course”, but is not working. This is the task:

Let’s add an environment variable as a configuration option.

Store the variable MESSAGE_STYLE=uppercase in the .env file. Then tell the GET /json route handler that you created in the last challenge to transform the response object’s message to uppercase if process.env.MESSAGE_STYLE equals uppercase . The response object should become {"message": "HELLO JSON"} .

Can you help me please?

Your code so far

if (process.env.MESSAGE_STYLE === “uppercase”) {

app.get("/json", (req, res) => {
res.json({
message: “Hello json”.toUpperCase()
});
});

} else {
app.get("/json", (req, res) => {
res.json({
message: “Hello json”
});
});
}

link to edit the file: https://glitch.com/edit/#!/join/b3ed7e39-f454-4b00-afb3-a7318eb1a18e

Your browser information:

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

Challenge: undefined

Link to the challenge:

1 Like