npm node dotenv code example
Example 1: dotenv npm
//In CMD
npm i dotenv
//in JS file
require('dotenv').config();
Example 2: node dotenv
require('dotenv').config();
console.log(process.env.MY_ENV_VAR);
//In CMD
npm i dotenv
//in JS file
require('dotenv').config();
require('dotenv').config();
console.log(process.env.MY_ENV_VAR);