dotenv (Nodejs Library) Cheatsheet
dotenv loads environment variables from .env file to process.env
Installation
npm install dotenv
Usage
Add the folllowing line in the beginning of your Node application. This loads the environemnt variables from .env
file to process.env
require('dotenv').config()
.env
file syntax
APPLICATION_PORT=8080
once this is defined you can access using process.env.APPLICATION_PORT