Use the .env File code doesn't work

Can someone please explain why does this not work?
app.get("/json", (req, res) => {
if(process.env.MESSAGE_STYLE === ‘uppercase’){
res.json({“message”: “HELLO JSON”})
} else {
res.json({“message”: “Hello json”})

it gives the correct output. Also, the hint code is quite similar. Any help would be highly appreciated.

Your project link(s)


Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36

Challenge: Use the .env File

Link to the challenge:

Hey bro,
if ur using replit, theres a side bar with a lock symbol…
click on tht, make a “secrets” name it as MESSAGE_STYLE and below tht put ur uri code…
and then it will work

Hey, thanks for the response @meherr17.j
I added the env variable in the same manner you described, however the code still didn’t work.
Surprisingly, I closed and restarted replit and fcc, and passed the test. Thanks again for taking the time out to help here.

Ohh sry if it hadnt worked…
well if u passed no prob…

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