//In CMD
npm i dotenv
//in JS file
require('dotenv').config();
require('dotenv').config();
console.log(process.env.MY_ENV_VAR);
//In CMD
// npm i dotenv
//in JS file
const env = require('dotenv');
const app = express();
env.config({
path: './config/.env'
});
//use
const PORT = process.env.PORT;
npm install dotenv
npx nodemon -r dotenv/config server.js
const config = require('dotenv-config')();
console.log(config.test); // localhost
module.exports = config;
import * as dotenv from 'dotenv' // see https://github.com/motdotla/dotenv#how-do-i-use-dotenv-with-import
dotenv.config()
import express from 'express'
require('dotenv').config()
console.log(process.env.PATH)
import * as dotenv from 'dotenv' // see https://github.com/motdotla/dotenv#how-do-i-use-dotenv-with-import
dotenv.config()
import express from 'express'