Express Correlation ID Middleware
JSON →express-correlation-id is an Express middleware that provides a unique correlation identifier for each incoming HTTP request, ensuring consistency across all asynchronous operations within the request's lifecycle. It automatically generates a UUID if no `x-correlation-id` header is present (or a configurable custom header). The library is currently stable at version 3.0.1, with recent updates indicating active maintenance. Version 3.x introduced a breaking change by requiring Node.js 16 or newer, with Node.js 20 being recommended. Its key differentiators include a simple API to access the ID via both the `req` object (`req.correlationId()`) and a static module method (`correlator.getId()`), as well as the ability to programmatically set the ID. It differentiates itself by its focus on robust async context handling for the correlation ID.
Traffic · last 30 days ↓62% vs prev 7d
top countries 🇨🇦 Canada · 🇺🇸 United States · 🇪🇸 Spain · 🇫🇷 France · 🇩🇪 Germany