Use the .env file (with replit)

I can’t pass the test on this challenge:

When I point to the /json endpoint, the object served appears to change depending on the .env variable.
The FCC test tells me otherwise!
Can anyone tell me what is wrong with my code please?
https://replit.com/@igorgetmeabrain/boilerplate-express#myApp.js

You need to check the value of the environment variable inside of the GET

Also, I don’t think that your if condition does wdat you want. a === a is always true.

1 Like

I thought I had figured out what I was doing wrong but, having changed my code, it’s still not working! The /json endpoint is doing what I expect but I can’t see where I’m going wrong, because I can’t pass the challenge.
Also, console.log(messageCase) shows nothing in the replit console…

I guess it’s the vagaries of the FCC test for this challenge but I finally got it to work when I expressly set my if condition to check the env variable directly, as opposed to via a variable.
PASS: if (process.env.MESSAGE_STYLE===“uppercase”)
FAIL: const messageCase=process.env.MESSAGE_STYLE;

if (messageCase===“uppercase”)

I hope this helps others!