Setup environment variables with Node.js + Dotenv Tutorial | Configuring Environment Variables Node

preview_player
Показать описание

a) what is env variable

c) Using dotenv with NodeJS and Environment Variables

development - port, db config,username, password etc- 8000, smtp auth{email, pass}

Testing - port, db config,username, password, filepath etc - 8001

Production - port, db config,username, password, filepath etc - 8002, 8003 auth{email, pass}

Command line argumant--- PORT= 3000 npm start

create .env file and declare the values inside that file.

create .env file inside project directory

add this .gitignore

Declare all your config values

dotenv module npm library

Link to get the dotenv module

Get the updated code from here

Рекомендации по теме