Skip to content

Commit fb61fd8

Browse files
authored
Merge pull request #74 from boostcampwm-2024/chore/swagger
📦 chore: swagger 환경 구축
2 parents 3596a3c + 3d36fea commit fb61fd8

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

server/src/common/swagger/swagger.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { INestApplication } from '@nestjs/common';
2+
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
3+
4+
export function setupSwagger(app: INestApplication) {
5+
const config = new DocumentBuilder()
6+
.setTitle('Denamu')
7+
.setDescription('개발자들의 이야기가 자라나는 곳, 데나무🎋 API 명세서')
8+
.setVersion('1.0')
9+
.build();
10+
11+
const documentFactory = () => SwaggerModule.createDocument(app, config);
12+
SwaggerModule.setup('api-docs', app, documentFactory);
13+
}

server/src/main.ts

+3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import { NestFactory } from '@nestjs/core';
22
import { AppModule } from './app.module';
3+
import { setupSwagger } from './common/swagger/swagger';
34

45
async function bootstrap() {
56
const app = await NestFactory.create(AppModule);
7+
setupSwagger(app);
68
await app.listen(process.env.PORT ?? 3000);
79
}
10+
811
bootstrap();

0 commit comments

Comments
 (0)