Tell us what’s happening:
I do not understand what I amdoing wrong with this code so far.
Your code so far
app.get("/json", (req, res) => {
let message = "Hello json";
if (process.env.MESSAGE_STYLE === "uppercase") {
res.json({ message: message.toUpperCase() });
} else {
res.json({ message: message });
}
});
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36
.
Challenge: Use the .env File
Link to the challenge:
I’m still not as far as you, but I see that you are checking the message style.
if uppercase
change to uppercase
else
just send message
you need toUpperCase() the messages that don’t pass your if test.
Sky020
3
Hello there,
Just to make sure:
- This is what should be in the
.env
file: MESSAGE_STYLE=uppercase
Now, this lesson has had issues, over the past few days, likely due to a breaking change with a package used in the testing.
So, I recommend you move on, from it. Or, you can clone the project into CodeSandbox, and complete it there.
Hope this helps