Link to challenge: /apis-and-microservices/basic-node-and-express/use-the–env-file/ (I’m too new to post whole links here yet )
I know that the .env file is supposed to be a “secret” file but I hadn’t realized it’d be so hard to find. It seems I’m the only one with this problem. Everything on Google mentions either creating a .env file for specific projects or using the dotenv library to make working with .env easier but no FFC users seem to have had this issue so I must be missing something.
The challenge says " Let’s add an environment variable as a configuration option. Store the variable MESSAGE_STYLE=uppercase in the .env file." implying the env file is already there and server.js uses process.env I in my mind it must be there (but maybe not locally in my project?). Please advise
Just to clarify, there is nothing magical about a .env file. It is just another file. You should be able to see it (although some environments make all files that begin with a period hidden unless you do something to see them.)
By convention, we usually put something in the .gitignore file that tells git not to save that file on the repo. That way it is “secret” - visible to you but no one else can see it. In theory though, you could make any file a “secret” file or make the .env a regular file. But it is a common convention to use .env for things you need secret.