express-swagger-ui-router
v2.3.0
Published
Serve swagger-ui and a local configuration file with express.js (without hacking `node_modules/swagger-ui/dist/index.html`)
Downloads
38
Maintainers
Readme
express-swagger-ui-router 
Cleanly serve swagger-ui and a local openapi configuration file.
Installation
npm install --save express-swagger-ui-router
# Install peer dependencies
npm install --save swagger-ui express Usage
This module exports a single function with a configFile parameter which takes the path to a local openapi configuration file. It returns an express.Router instance which can be mounted at any desired path.
import express from 'express';
import path from 'path';
import swaggerServer from 'express-swagger-ui-router';
const app = express();
app.use('/swagger',
swaggerServer({ configFile: path.resolve(__dirname, 'openapi.json') }));
app.listen(3000);
// Access swagger-ui at localhost:3000/swagger- Forked from express-swagger-ui by Andreas Pizsa (github/AndreasPizsa, twitter/AndreasPizsa).
