Hi, I’ve got a problem with the “Use the .env File” node challenge. My code works fine (i.e. if I go to my Glitch live app I can see that it works as it should) but the test just won’t pass, failing with a " The response of the endpoint /json
should change according to the environment variable MESSAGE_STYLE
" error, which is infuriating to put it mildly. The relevant code is:
let message = "Hello json";
message = process.env.MESSAGE_STYLE == "uppercase" ? message.toUpperCase() : message;
app.get("/json", (req, res) => res.json({"message": message}));
I’m honestly getting kinda tired of wasting my time because of FCC’s badly written tests; this is not the first time something like this has happened but it is the first time I’m unable to fix it. Can someone just post code that actually passes the f*** test? Believe me, I’ve googled and tried every piece of code people have posted here and nothing worked.