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"}
.
Here is my code:
app.get("/json", (req, res) => {
if (process.env.MESSAGE_STYLE === "uppercase") {
response = "Hello json".toUpperCase();
} else {
response = "Hello json";
}
res.json({"message": response});
});
any help is greatly appreciated, i’m getting very frustrated because i followed the hint exactly… tried ternary operations, nothing is working but I get fine output. I’ve tried declaring response outside the get method, inside the get method, not sure what to do…