swagger with nest
$ npm install --save @nestjs/swagger fastify-swagger
Source: docs.nestjs.com
nestjs swagger
import { NestFactory } from '@nestjs/core'; import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; import { AppModule } from './app.module'; async function bootstrap() { const app = await NestFactory.create(AppModule); const options = new DocumentBuilder() .setTitle('Cats example') .setDescription('The cats API description') .setVersion('1.0') .addTag('cats') .addBearerAuth() .build(); const document = SwaggerModule.createDocument(app, options); SwaggerModule.setup('api', app, document); await app.listen(3000); console.log(`Application is running on: ${await app.getUrl()}`); } bootstrap();
Source: github.com