Replace express-request-id with an inline middleware
ProprietaryReplaces the express-request-id middleware factory with an equivalent inline middleware that reuses an incoming X-Request-Id header or generates an id with randomUUID() from node:crypto (Node.js 14.17+), stores it on the request and echoes it in the response header. The setHeader, headerName, attributeName and generator options carry over; calls with other options, or options that aren't literals, are left alone. attributeName is honored as in 1.x; versions 2 and 3 ignore it and always set req.id. In TypeScript the id is set with Object.assign so no Request augmentation is needed, and a middleware stored in a variable is typed as Express's RequestHandler.
org. openrewrite. node. migrate. express-request-id. replace-express-request-idmod run . --recipe= org. openrewrite. node. migrate. express-request-id. replace-express-request-idInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.