Express middleware that automatically collects standard Prometheus metrics (HTTP request duration, request count, active connections, etc.) for Node.js applications. Version 0.1.14 is the current stable release, updated infrequently. Compared to prom-client or express-prom-bundle, this package offers a zero-configuration setup with sensible defaults and built-in TypeScript types. It is opinionated and designed for quick integration without manual metric definition, but may have limited customization options.
npm install express-metrics-middlewareVerified import paths — ran on the pinned version, not inferred.
Shows how to create an Express server with the middleware that collects Prometheus metrics automatically.
Route /metrics explicitly with your own handler if you need custom behavior.
Use import { createMiddleware } from 'express-metrics-middleware' instead.Pass { collectDefaultMetrics: false } to createMiddleware.Use import { createMiddleware } from 'express-metrics-middleware'Run npm install prom-client
Ensure app.use(createMiddleware()) is called before other routes.