Help with handling a .env file

Tell us what’s happening:
I can’t seem to be able to find the .env file and I can’t seem to be able to get the correct code either. Can you please explain to me what’s happening here?

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36.

Challenge: Use the .env File

Link to the challenge:

1 Like

You haven’t created one, that’s why it’s not there. Then you just write exactly what it says to write in that file (assign the value uppercase to the variable MESSAGE_STYLE)

Oh, so I create a .env file and name it whatever I want and then add the key?

No, no, you call it .env, it’s a .env file

so like anyName.env?

No, .env, that’s the file

K thanks. I’ll try that. I was just wondering since usually all files have a name and then a file type like index.html.

Sorry to bother you again, but I don’t exactly know what the challenge wants me to do in the myApp.js file. I looked at the hint and tried to get it to work, but I’m still stuck.

You can access the values defined in the env file in your JS code using process.env.WHATEVER_THE_VARIABLE_IS_CALLED. So you need to check what the variable is and do the thing if the value is “uppercase”

1 Like

Thank you for taking your time to help me. I got it.

1 Like