Skip to content

lleaff/express-swagger-ui-router

 
 

Repository files navigation

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

About

Cleanly serve swagger-ui and a local openapi config file with express.js.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%