[NestJS] Swagger

woogiemon·2023년 3월 8일
0
post-thumbnail

dependency 설치

npm install --save @nestjs/swagger

main.ts

import { NestFactory } from '@nestjs/core';
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);

  const config = new DocumentBuilder()
    .setTitle('제목')
    .setDescription('설명')
    .setVersion('버전')
    .addTag('태그')
    .build();
  const document = SwaggerModule.createDocument(app, config);
  SwaggerModule.setup('api', app, document);

  await app.listen(3000);
}
bootstrap();
profile
삽질 기록..

0개의 댓글