Set up and Test a Dot Env (.env) File in Node

Опубликовано: 03 Февраль 2021
на канале: Hey Node
1,176
18

See the written version of this tutorial for links to prerequisites and related tutorials: hhttps://heynode.com/tutorial/set-and-...

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.