See the written version of this tutorial for links to prerequisites and related tutorials: hhttps://heynode.com/tutorial/set-and-test-dot-env-env-file?utm_source=youtube&utm_medium=referral+&utm_campaign=YT+description&utm_content=set-up-and-test-a-dot-env-file-in-node
Using the dotenv package, we can add a .env file to our Node.js project to serve as a central place to manage and document environment variables. This makes them easier to update, maintain, and perhaps most importantly, to discover. Environment variables allow you to run your Node.js app anywhere.
In this tutorial we'll:
- Create an .env file for our local environment and populate it with some key value pairs
- Use the dotenv package to read and parse the .env file and access the data it contains via the process.env global
- Provide some additional thoughts about best practices for managing and documenting environment variables in Node with .env files
Heynode.com: The best online Node.js courses and tutorials to help you solve hard problems fast.
Ещё видео!