Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] swagger 세팅 #102

Merged
merged 4 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,18 @@
"@nestjs/common": "^10.0.0",
"@nestjs/core": "^10.0.0",
"@nestjs/platform-express": "^10.0.0",
"reflect-metadata": "^0.2.0",
"rxjs": "^7.8.1",
"@nestjs/swagger": "^8.0.1",
"@repo/shards": "workspace:*",
"@repo/types": "workspace:*"
"@repo/types": "workspace:*",
"reflect-metadata": "^0.2.0",
"rxjs": "^7.8.1"
},
"devDependencies": {
"@nestjs/cli": "^10.0.0",
"@nestjs/schematics": "^10.0.0",
"@nestjs/testing": "^10.0.0",
"@repo/lint": "workspace:*",
"@repo/tsconfig": "workspace:*",
"@types/express": "^5.0.0",
"@types/jest": "^29.5.2",
"@types/node": "^20.3.1",
Expand All @@ -49,9 +52,7 @@
"ts-loader": "^9.4.3",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.1.3",
"@repo/lint": "workspace:*",
"@repo/tsconfig": "workspace:*"
"typescript": "^5.1.3"
},
"jest": {
"moduleFileExtensions": [
Expand Down
3 changes: 3 additions & 0 deletions apps/api/src/app.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Controller, Get } from '@nestjs/common';
import { ApiOperation, ApiResponse } from '@nestjs/swagger';

import { AppService } from './app.service';

Expand All @@ -7,6 +8,8 @@ export class AppController {
constructor(private readonly appService: AppService) {}

@Get()
@ApiOperation({ summary: 'swaggerTest' })
@ApiResponse({ status: 200, description: '기본 존재하는 api Test.' })
begong313 marked this conversation as resolved.
Show resolved Hide resolved
getHello(): string {
return this.appService.getHello();
}
Expand Down
11 changes: 11 additions & 0 deletions apps/api/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
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);

//swagger setting
const config = new DocumentBuilder()
.setTitle('Ticle API server')
.setDescription('API 서버의 api 문서입니다.')
.setVersion('1.0')
.build();
const document = SwaggerModule.createDocument(app, config);
SwaggerModule.setup('api-doc', app, document);

await app.listen(process.env.PORT ?? 3000);
begong313 marked this conversation as resolved.
Show resolved Hide resolved
}
bootstrap();
84 changes: 79 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.