The .env File does not pass

The challenge says, in the /json GET route handler, transform the response object’s message to uppercase if process.env.MESSAGE_STYLE equals uppercase . The response object should either be {"message": "Hello json"} or {"message": "HELLO JSON"} , depending on the MESSAGE_STYLE value.
my code…

app.get("/json",  (req, res) => {
if (process.env.MESSAGE_STYLE === "uppercase") {
res.json({"message": "HELLO JSON"});
} else {
res.json({"message": "Hello Json"});
}
});

this code still wont pass…meanwhile ive created the MESSAGE_STYLE key with the value: ‘uppercase’ in the SECRETS (environment variable).

Hello,

I see that in the else branch you have Json and it should be json. Might be the reason why the test is not passing.

this worked…thank you

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