We'll be using a handy package called dotenv to bring all environment variables in a
.env file into our project.
Once we configure the package using:
We are able to call any variables from the environment using:
It's common practice to keep environment variable names fully uppercase.
Note: Be sure to add
.env to your
.gitignore so that it doesn't get committed to your repo. Keep secret info out of public repos!
Like this article? Follow @chrisoncode on Twitter