# Logs, Configuration and Shutdown

A server you can't see into is a server you can't fix. Log in a form tools can search, check every setting when the server starts, shut down without dropping a request, answer a health check, and measure before you try to make anything faster.

Updated: November 19, 2026

## [Logs](https://www.ask-codey.com/courses/nodejs-in-depth/topics/node-logging)

1. [Logging with pino](https://www.ask-codey.com/lessons/node-pro-logging-with-pino) (Journeyman): A server's logs are how you find out what happened after it happened, so pino writes each event as one JSON line with a level, pino-http adds a line for every request, redact hides tokens and passwords, and pino-pretty makes the lines readable while you develop.

## [Configuration and Shutdown](https://www.ask-codey.com/courses/nodejs-in-depth/topics/node-config-and-shutdown)

1. [Configuration Checked at Startup](https://www.ask-codey.com/lessons/node-pro-configuration) (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.
2. [Graceful Shutdown and Health Checks](https://www.ask-codey.com/lessons/node-pro-graceful-shutdown-and-health) (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.

## [Performance](https://www.ask-codey.com/courses/nodejs-in-depth/topics/node-performance)

1. [Performance Basics: Measure First](https://www.ask-codey.com/lessons/node-pro-performance-basics) (Freelancer): Before making an API faster, measure it, with a timing middleware for one request and autocannon for many at once, because the usual causes of a slow route are CPU work that blocks the event loop, a query with no index, or a list with no paging, and only numbers show which one it is.

## [Exercise: Shuttle Schedule API](https://www.ask-codey.com/courses/nodejs-in-depth/topics/exercise-node-shuttle-schedule-api)

1. [Exercise: Shuttle Schedule API](https://www.ask-codey.com/lessons/exercise-node-shuttle-schedule-api) (Journeyman): Get the campus shuttle's API ready for real riders, with settings checked by Zod at startup, a pino-http log line for every request with tokens and the database address redacted, a /health route that answers 200 or 503, and a graceful shutdown, and let the tests check each one.

Source: https://www.ask-codey.com/courses/nodejs-in-depth/chapters/node-logs-config-and-shutdown
