Using Environment Variables
Environment variables let you manage app settings like DB URLs and secret keys without hardcoding them.
- Use the
dotenvpackage to load variables from a.envfile - Access variables with
process.env - Keep sensitive info out of version control
require('dotenv').config();
const dbUrl = process.env.DB_URL;