Node.js · 14-day planAll days
Day 12 of 14 30 minEnv varsErrorsLogging
Get a Node app ready for production. Load and validate configuration from environment variables and .env files, keep secrets out of code, design error classes, handle crashes with process events, write structured logs, and shut down gracefully.
By the end of today you can
- Load configuration from environment variables and .env files, and validate it at startup
- Keep secrets out of code and Git
- Tell operational errors from programmer errors, and use custom error classes with a cause
- Write structured JSON logs with levels
- Shut a server down gracefully on SIGTERM
What's inside
- 4 sections
- 3 diagrams and mind maps
- 5 code examples you can run
- 5-question quiz
- 1Configuration from the environment
- 2Errors: expected and unexpected
- 3Structured logging
- 4Graceful shutdown
Sign in free to read this lesson
Get the full lesson with diagrams, runnable code and the quiz. Your progress is saved across devices.
Sign in free