
Research
SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.
redoc-express
Advanced tools
Lightweight Express middleware for serving interactive ReDoc API documentation from OpenAPI/Swagger specs. TypeScript support, 100% test coverage, ES5 compatible.
Lightweight Express middleware for serving interactive ReDoc API documentation from OpenAPI/Swagger specs with full TypeScript support and zero configuration overhead.
redoc-express makes it dead simple to add professional API documentation to your Express server. Unlike alternatives:
npm install redoc-express
const express = require('express');
const redoc = require('redoc-express');
const app = express();
const port = 3000;
// Serve your OpenAPI/Swagger spec
app.get('/docs/swagger.json', (req, res) => {
res.sendFile('swagger.json', { root: '.' });
});
// Mount ReDoc middleware
app.get(
'/docs',
redoc({
title: 'API Documentation',
specUrl: '/docs/swagger.json'
})
);
app.listen(port, () => {
console.log(`📚 API docs available at http://localhost:${port}/docs`);
});
import express, { Express } from 'express';
import redoc from 'redoc-express';
const app: Express = express();
const port = 3000;
// Serve your OpenAPI/Swagger spec
app.get('/docs/swagger.json', (req, res) => {
res.sendFile('swagger.json', { root: '.' });
});
// Mount ReDoc middleware with TypeScript support
app.get(
'/docs',
redoc({
title: 'API Documentation',
specUrl: '/docs/swagger.json',
redocOptions: {
theme: {
colors: {
primary: { main: '#1976d2' }
}
}
}
})
);
app.listen(port, () => {
console.log(`📚 API docs available at http://localhost:${port}/docs`);
});
app.get(
'/docs',
redoc({
title: 'My API Documentation',
specUrl: 'https://api.example.com/openapi.json',
nonce: 'random-nonce-123', // Optional: for CSP compliance
redocOptions: {
theme: {
colors: {
primary: { main: '#6EC5AB' }
},
typography: {
fontFamily: '"museo-sans", Helvetica, Arial, sans-serif',
fontSize: '15px'
},
menu: { backgroundColor: '#ffffff' }
},
hideDownloadButton: true,
expandResponses: '200,201,400'
}
})
);
For all available ReDoc configuration options, see the official documentation
| Option | Type | Required | Description |
|---|---|---|---|
title | string | Yes | Title displayed in the browser tab and header |
specUrl | string | Yes | URL to your OpenAPI/Swagger specification file |
nonce | string | No | Security nonce for Content Security Policy compliance |
redocOptions | object | No | ReDoc configuration options |
npm i
npm test
npm run build
| Metric | Coverage |
|---|---|
| Statements | 100% |
| Branches | 100% |
| Functions | 100% |
| Lines | 100% |
136 comprehensive test cases organized across 3 test suites:
Unit Tests - redocHtml (85+ tests)
Unit Tests - redocExpressMiddleware (51+ tests)
End-to-End Tests (26+ tests)
npm test # Run all 136 tests
npm test -- --coverage # With coverage report
npm test -- --watch # Watch mode during development
All tests pass with 100% code coverage in approximately 1-2 seconds.
Q: Can I use this with TypeScript? A: Yes! Full TypeScript support with included type definitions.
Q: Does this work with OpenAPI 3.0? A: Yes, both OpenAPI 3.0+ and Swagger 2.0 are supported.
Q: Is there a performance impact? A: Minimal. The middleware only serves static HTML—no runtime overhead.
Q: Can I customize the UI colors/fonts?
A: Yes, pass redocOptions with your theme configuration.
Q: What Node.js versions are supported? A: Node 6+ (ES5 compiled output). Development requires Node 18.14+.
MIT © Aung Myo Kyaw
FAQs
Lightweight Express middleware for serving interactive ReDoc API documentation from OpenAPI/Swagger specs. TypeScript support, 100% test coverage, ES5 compatible.
We found that redoc-express demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.

Company News
Socket is proud to join the OpenJS Foundation as a Silver Member, deepening our commitment to the long-term health and security of the JavaScript ecosystem.

Security News
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.