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

Publicado el: 26 julio 2021
en el canal de: Coding from experience
50
3

Today I will explain how to access the Environment variable in the Node js project. Working with environment variables is a great way to configure different aspects of your Node.js application.

a) what is env variable

b) How many ways we can setup the env variable in Node.js

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

Fetch those env values to Node.js file


Link to get the dotenv module

https://www.npmjs.com/package/dotenv

Get the updated code from here

https://github.com/subhrajyotiw5rtc/t...


En esta página del sitio puede ver el video en línea Setup environment variables with Node.js + Dotenv Tutorial | Configuring Environment Variables Node de Duración hora minuto segunda en buena calidad , que subió el usuario Coding from experience 26 julio 2021, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 50 veces y le gustó 3 a los espectadores. Disfruta viendo!