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 defined you can access using process.env.APPLICATION_PORT



┬ęCopyright 2020 OneCompiler | Privacy Policy | Terms & Conditions