snippet Thursday 25 April 2024
Author
Eric Wallen
The primary use of environment variables is to hide sensitive data or to provide different data based on the environment you are in
in your terminal run two commands:
Inside the .env file add in your variable
YOURUNIQUEKEYHERE=valueoverhere
Inside your js file require dotenv then access your variable
require('dotenv').config()
console.log(process.env.YOURUNIQUEKEYHERE)