Rockets NestJS Swagger UI
Expose your OpenApi spec on your API using the powerful Swagger UI interface.
Project
(opens in a new tab)
(opens in a new tab)
(opens in a new tab)
(opens in a new tab)
(opens in a new tab)
Overview
The Swagger UI module provides a simple implementation of the @nestjs/swagger (opens in a new tab) module.
Using this module, you can register the Swagger UI just like a normal module to reduce the amount of boilerplate in your main.ts.
Installation
yarn add @concepta/nestjs-swagger-ui
Usage
app.module.ts
@Module({
imports: [
SwaggerUiModule.register({
settings: {
path: 'api',
basePath: '/v1',
},
}),
],
})
export class AppModule {}
main.ts
async function bootstrap() {
// create app
const app = await NestFactory.create(AppModule);
// get the swagger ui service
const swaggerUiService = app.get(SwaggerUiService);
// set it up
swaggerUiService.setup(app);
// start listening
await app.listen(3000);
}
bootstrap();
Configuration
All of the options in the official docs for NestJS OpenApi (opens in a new tab) are supported.
To see how they are mapped to the registration options settings
property,
see the SwaggerUiSettingsInterface (opens in a new tab)