개발/NestJs

7. Swagger

희묭 2023. 10. 20. 11:48

7. Swagger


1) 설치

yarn add @nestjs/swagger
yarn add swagger-ui-express

2) 활용

main.ts 는 아래와같이 활용

const app = await NestFactory.create(AppModule);

const config = new DocumentBuilder()
	.setTitle('Cats example')
	.setDescription('The cats API description')
	.setVersion('1.0')
	.addTag('cats')
	.build();
const document = SwaggerModule.createDocument(app, config);
SwaggerModule.setup('api', app, document);

await app.listen(3000);