@routup/swagger-ui
v4.0.0
Published
Swagger UI plugin for routup — mount swagger-ui-dist on any path.
Maintainers
Readme
@routup/swagger-ui
Mount Swagger UI on a routup App to serve an OpenAPI document interactively. To produce the document from decorated controllers, see the @routup/decorators OpenAPI generation docs — the preset feeds straight into @trapi/swagger's generateSwagger().
Installation
npm install @routup/swagger-uiDocumentation
To read the docs, visit https://routup.net
Usage
import { App, serve } from 'routup';
import { swaggerUI } from '@routup/swagger-ui';
const router = new App();
router.use('/docs', swaggerUI('./openapi.json'));
serve(router, { port: 3000 });Open http://localhost:3000/docs/ in a browser.
You can also pass a parsed spec object or a remote URL:
router.use('/docs', swaggerUI({ openapi: '3.0.0', /* ... */ }));
router.use('/docs', swaggerUI('https://petstore3.swagger.io/api/v3/openapi.json'));License
Made with 💚
Published under MIT License.
