express-swagger-ui-router
TypeScript icon, indicating that this package has built-in type declarations

2.3.0 • Public • Published

express-swagger-ui-router NPM version

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

Package Sidebar

Install

npm i express-swagger-ui-router

Weekly Downloads

2

Version

2.3.0

License

MIT

Unpacked Size

7.99 kB

Total Files

9

Last publish

Collaborators

  • lleaff