@node-xray/express
v1.0.1
Published
Express middleware for node-xray
Maintainers
Readme
@node-xray/express
Express middleware adapter for node-xray — a live runtime inspector for Node.js backends.
Install
npm install --save-dev @node-xray/expressPeer dependency: Express ^4.19 || ^5
Quick start
const express = require('express');
const { xray } = require('@node-xray/express');
const app = express();
app.use(express.json());
app.use(xray()); // attach node-xray
app.get('/api/users', (req, res) => res.json({ ok: true }));
app.listen(3000, () => console.log('Dashboard: http://localhost:3000/node-xray'));Configuration
app.use(
xray({
path: '/node-xray', // dashboard URL (default)
enabled: process.env.NODE_ENV !== 'production',
captureRequestBody: true,
captureResponseBody: true,
maxBodySize: 100 * 1024, // 100 KB
maxRequests: 200, // ring buffer size
ignore: (ctx) => ctx.path === '/health',
redactHeaders: ['authorization', 'cookie'],
redactBodyPaths: ['password', '*.token'],
}),
);See the full option matrix in the Configuration docs.
What you get
Open http://localhost:3000/node-xray to see a live dashboard with:
- Request/response headers and bodies (with automatic redaction)
- Call stacks per request
- Event-loop lag (p50/p99/max) and utilization
- Live stats bar: total requests, 2xx/errors, avg latency, loop lag
