Configuration and Shutdown
Configuration and Shutdown: Configuration Checked at Startup, Graceful Shutdown and Health Checks.
Updated
- Configuration Checked at Startup (Journeyman): An API reads every setting it needs in one config module that checks them all with Zod when the server starts, so a missing or mistyped setting stops it at once with a message naming each problem, and NODE_ENV, an .env file and the host's own settings decide the values in each place it runs.
- Graceful Shutdown and Health Checks (Freelancer): A host stops your API with SIGTERM on every deploy, so a graceful shutdown stops taking new requests, lets the ones in progress finish with server.close, then closes MongoDB, and a /health route answers 200 or 503 so the host knows whether to send the API riders.