koa2-swagger-ui
Host swagger ui at a given directory from your koa v2 app.
Inspired by:
install
npm install koa2-swagger-ui --save
config
for more swaggerOptions see swagger-ui
defaults:
title: 'swagger',
oauthOptions: {},
swaggerOptions: {
supportedSubmitMethods: ['head', 'get', 'post', 'put', 'patch', 'delete'],
apisSorter: 'alpha',
operationsSorter: 'alpha',
docExpansion: 'none',
},
routePrefix: '/docs',
example
const Koa = require('koa');
const koaSwagger = require(koa2-swagger-ui);
const app = new Koa();
app.use(koaSwagger({
routePrefix: '/swagger',
url: 'http://petstore.swagger.io/v2/swagger.json'
}));
app.listen(3000);