DotEnv
What is DotEnv?
- DotEnv is the use of a .env file in a project to manage __ __ like API keys, database credentials, and other information.
- The term “dotenv” is often associated with a specific library or tool that helps load these variables into the application’s environment.
- Its purpose is to avoid putting sensitive information, such as access tokens, directly into the __ __ or __ __ and instead it is put in the .env file, which is specific to each environment.
To make it work
- Navigate to your project’s root directory using the command line:
cd /home/kaiden_d0/vscode/kaidencsablog
- Initialize a new package.json file for your project:
npm init -y
- Now, you can install dotenv:
npm install dotenv
- Make sure to add the .env file to your .gitignore so the sensitive information is not exposed
Popcorn Hack
Make your own .env file, and make the js file display your own secret information (put screenshots).