Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

dotenv nodejs

// Terminal/CMD
npm i dotenv

//In .env file
SPECIAL_KEY = 0000000 //whatever the key

//In nodejs file - 2 point usage
//1 - initialisation
require('dotenv').config();
//2 - using the special key
const specialKey = process.env.SPECIAL_KEY
console.log(specialKey);
 
PREVIOUS NEXT
Tagged: #dotenv #nodejs
ADD COMMENT
Topic
Name
5+5 =