@concepta/nestjs-swagger-ui
TypeScript icon, indicating that this package has built-in type declarations

4.0.0-alpha.44 • Public • Published

Rockets NestJS Swagger UI

Expose your OpenApi spec on your API using the powerful Swagger UI interface.

Project

NPM Latest NPM Downloads GH Last Commit GH Contrib NestJS Dep

Overview

The Swagger UI module provides a simple implementation of the @nestjs/swagger 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 are supported.

To see how they are mapped to the registration options settings property, see the SwaggerUiSettingsInterface

Readme

Keywords

none

Package Sidebar

Install

npm i @concepta/nestjs-swagger-ui

Weekly Downloads

137

Version

4.0.0-alpha.44

License

BSD-3-Clause

Unpacked Size

20.1 kB

Total Files

23

Last publish

Collaborators

  • mrmaz
  • leoafarias