HTTP request logger middleware with colour-coded output.
Logs each completed request with method, path, status code, and duration.
Output is colour-coded by HTTP method and status code for fast visual scanning:
Methods: GET (blue), POST (green), DELETE (red), others (yellow)
Description
HTTP request logger middleware with colour-coded output.
Logs each completed request with method, path, status code, and duration. Output is colour-coded by HTTP method and status code for fast visual scanning:
The logger attaches to the
res.on('finish')event so duration includes the full round-trip including response serialisation.Example