Skip to content

Latest commit

 

History

History

34-env-vars

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Lesson 34: Environment variables

Configuration via the environment, not hard-coded values.

What you'll learn

  • read with process.env.NAME
  • set inline: PORT=4000 node app.js
  • load a .env file with the dotenv package
  • never commit secrets — keep them in env vars

Example

See examples/.

Exercise

Read DB config from env with sensible defaults.