Nodejs Dotenv Path How To Set

[Solved] Nodejs Dotenv Path How To Set | Whatever - Code Explorer | yomemimo.com
Question : node dotenv

Answered by : httpsgithubcomgarzj

require('dotenv').config();
console.log(process.env.MY_ENV_VAR);

Source : | Last Update : Wed, 14 Oct 20

Question : nodejs dotenv path how to set

Answered by : andrzej

// when yours .env is in other place then default, you can set path to it
const path = require('path')
require('dotenv').config({ path: path.resolve(__dirname, '../../.env') }); //use as many '../' as you need

Source : | Last Update : Wed, 21 Oct 20

Question : node dotenv

Answered by : eugene-chiu

const config = require('dotenv-config')();
console.log(config.test); // localhost
module.exports = config;

Source : | Last Update : Sat, 25 Jun 22

Answers related to nodejs dotenv path how to set

Code Explorer Popular Question For Whatever