Need help figuring out how complete the env challenge

Tell us what’s happening:
It’s safe to say that I have no idea what’s going on in regards to this specific challenge, and the hint was not at all helpful to me. I’m not sure if i’m supposed to make a .env file, or use one that’s already built in, and how i’m supposed to modify it, or even what the desired result is. I’m ASSUMING that the challenge result is supposed to be that it takes the json file and makes it uppercase. Now if that’s the case i’m not exactly sure if i’m supposed to directly modify the json file with some sort of string manipulation like .toUpperCase, or if simply replacing it with an all caps version would suffice, and how I would go about doing either of those two things.

Your code so far
const MESSAGE_STYLE=‘uppercase’;
app.get(’/json’,
function(req, res){
if( process.env.MESSAGE_STYLE === ‘uppercase’ )
res.json({“message”: “HELLO JSON”})
})

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0.

Challenge: Use the .env File

Link to the challenge:

Hello~!

This does not go in your server.js file. You need to add the MESSAGE_STYLE value to your .env file. :slight_smile:

Okay, that’s a big step forward alone. Now, there was no .env file included, so is it safe to say that I have to make my own?

Hmm, the boilerplate should have included a .env file.

Out of curiosity, did you start this project by remixing the FCC project? Or did you make it from scratch?

I clicked the link it brought me to glitch.com, it had most of the files that I needed. However there was no process.env file which is why I was noticeably confused at first. I also downloaded it off github and that didn’t have the process.env file either, so I guess someone forgot to put it in. I made my own now called process.env and put in MESSAGE_STYLE=‘uppercase’, though I still haven’t solved the problem, at least the file is there now lol

Not process.env
The file is just called .env

Making even more progress. Didn’t expect the file to just be called .env. But once I removed process from the start, the icon next to it turned into a heart shaped key picture. It also allowed the condition to evaluate properly in the if else statement. Now I just need to get the object to uppercase. It says .toUpperCase is not a function.

Progress is good!
The heart shaped key shows you that it’s secure - if I view your public code I can’t see the .env file contents.

.toUpperCase() is a JS prototype function that can be chained to a string. See the MDN documentation page for usage.