-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #154 from boostcampwm-2024/Feature/#149_swagger_์ธํ
Feature/#149 Swagger API ๋ฌธ์ ๊ตฌ์ถ
- Loading branch information
Showing
7 changed files
with
152 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { ApiProperty } from "@nestjs/swagger"; | ||
|
||
export class UserDto { | ||
@ApiProperty({ | ||
description: "The unique identifier of the user", | ||
example: "5f8f8c44b54764421b7156c9", | ||
}) | ||
id: string; | ||
|
||
@ApiProperty({ | ||
description: "The email address of the user", | ||
example: "[email protected]", | ||
}) | ||
email: string; | ||
|
||
@ApiProperty({ | ||
description: "The name of the user", | ||
example: "John Doe", | ||
}) | ||
name: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { INestApplication } from "@nestjs/common"; | ||
import { SwaggerModule, DocumentBuilder } from "@nestjs/swagger"; | ||
|
||
export const createSwaggerDocument = (app: INestApplication): void => { | ||
if (process.env.NODE_ENV !== "development") { | ||
return; // ๊ฐ๋ฐ ํ๊ฒฝ์ด ์๋๋ฉด Swagger ๋นํ์ฑํ | ||
} | ||
|
||
const config = new DocumentBuilder() | ||
.setTitle("Nocta API Docs") | ||
.setDescription("Nocta API description") | ||
.setVersion("1.0.0") | ||
.build(); | ||
|
||
const document = SwaggerModule.createDocument(app, config); | ||
SwaggerModule.setup("api-docs", app, document); | ||
}; |