EXAMPLE OF NODE.JS USING:
- DOTENV: A PACKAGE TO DEFINE ENVIRONMENT VARIABLES.
INSTALL THE DOTENV VSCODE EXTENSION.
npm install dotenv
- CREATE .env FILE. THIS FILE WILL CONTAIN ENVIRONMENTAL VARIABLES AVAILABLE THROUGH
process.env.variablename
. - IF YOU ARE USING GIT, ADD .env AS A NEW LINE IN .gitignore (GOOD PRACTICE).
npx nodemon ./folderSource/folderTopics/folderDotenv/exampleDotenv.js