Skip to content

Commit

Permalink
[add]: add swagger in pwrcode-backend
Browse files Browse the repository at this point in the history
  • Loading branch information
IMHOJEONG committed Nov 7, 2023
1 parent c3df85f commit 109ad27
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 12 deletions.
1 change: 1 addition & 0 deletions apps/pwrcode-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@nestjs/common": "^10.0.0",
"@nestjs/core": "^10.0.0",
"@nestjs/platform-express": "^10.0.0",
"@nestjs/swagger": "^7.1.14",
"@nestjs/typeorm": "^10.0.0",
"mysql2": "^3.6.3",
"reflect-metadata": "^0.1.13",
Expand Down
12 changes: 12 additions & 0 deletions apps/pwrcode-backend/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
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('Test Example')
.setDescription('Hojeong API description')
.setVersion('1.0')
.addTag('cats')
.build();

const document = SwaggerModule.createDocument(app, config);
SwaggerModule.setup('api', app, document);

await app.listen(3000);
}
bootstrap();
76 changes: 64 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,23 @@ __metadata:
languageName: node
linkType: hard

"@nestjs/mapped-types@npm:2.0.2":
version: 2.0.2
resolution: "@nestjs/mapped-types@npm:2.0.2"
peerDependencies:
"@nestjs/common": ^8.0.0 || ^9.0.0 || ^10.0.0
class-transformer: ^0.4.0 || ^0.5.0
class-validator: ^0.13.0 || ^0.14.0
reflect-metadata: ^0.1.12
peerDependenciesMeta:
class-transformer:
optional: true
class-validator:
optional: true
checksum: 9a6d4c32242926aebc267d5a4a0b50f8aa8eeea8797e25aa9fb762637a45879c1ec103a9a0a30d24e8a6e3f75d0f4640208aaf4f9003e350b52f7e4acb07bab9
languageName: node
linkType: hard

"@nestjs/platform-express@npm:^10.0.0":
version: 10.2.8
resolution: "@nestjs/platform-express@npm:10.2.8"
Expand Down Expand Up @@ -1009,6 +1026,33 @@ __metadata:
languageName: node
linkType: hard

"@nestjs/swagger@npm:^7.1.14":
version: 7.1.14
resolution: "@nestjs/swagger@npm:7.1.14"
dependencies:
"@nestjs/mapped-types": "npm:2.0.2"
js-yaml: "npm:4.1.0"
lodash: "npm:4.17.21"
path-to-regexp: "npm:3.2.0"
swagger-ui-dist: "npm:5.9.0"
peerDependencies:
"@fastify/static": ^6.0.0
"@nestjs/common": ^9.0.0 || ^10.0.0
"@nestjs/core": ^9.0.0 || ^10.0.0
class-transformer: "*"
class-validator: "*"
reflect-metadata: ^0.1.12
peerDependenciesMeta:
"@fastify/static":
optional: true
class-transformer:
optional: true
class-validator:
optional: true
checksum: cb89a72b143f315d3cc102cf3b6f2d0655fd16aad6ea8bfedd43632e1170bcfb668746623e8c6185b804720ea061557feec0a234a1ecce77cb8574713644c48a
languageName: node
linkType: hard

"@nestjs/testing@npm:^10.0.0":
version: 10.2.8
resolution: "@nestjs/testing@npm:10.2.8"
Expand Down Expand Up @@ -5749,26 +5793,26 @@ __metadata:
languageName: node
linkType: hard

"js-yaml@npm:^3.13.1":
version: 3.14.1
resolution: "js-yaml@npm:3.14.1"
"js-yaml@npm:4.1.0, js-yaml@npm:^4.1.0":
version: 4.1.0
resolution: "js-yaml@npm:4.1.0"
dependencies:
argparse: "npm:^1.0.7"
esprima: "npm:^4.0.0"
argparse: "npm:^2.0.1"
bin:
js-yaml: bin/js-yaml.js
checksum: 6746baaaeac312c4db8e75fa22331d9a04cccb7792d126ed8ce6a0bbcfef0cedaddd0c5098fade53db067c09fe00aa1c957674b4765610a8b06a5a189e46433b
checksum: 184a24b4eaacfce40ad9074c64fd42ac83cf74d8c8cd137718d456ced75051229e5061b8633c3366b8aada17945a7a356b337828c19da92b51ae62126575018f
languageName: node
linkType: hard

"js-yaml@npm:^4.1.0":
version: 4.1.0
resolution: "js-yaml@npm:4.1.0"
"js-yaml@npm:^3.13.1":
version: 3.14.1
resolution: "js-yaml@npm:3.14.1"
dependencies:
argparse: "npm:^2.0.1"
argparse: "npm:^1.0.7"
esprima: "npm:^4.0.0"
bin:
js-yaml: bin/js-yaml.js
checksum: 184a24b4eaacfce40ad9074c64fd42ac83cf74d8c8cd137718d456ced75051229e5061b8633c3366b8aada17945a7a356b337828c19da92b51ae62126575018f
checksum: 6746baaaeac312c4db8e75fa22331d9a04cccb7792d126ed8ce6a0bbcfef0cedaddd0c5098fade53db067c09fe00aa1c957674b4765610a8b06a5a189e46433b
languageName: node
linkType: hard

Expand Down Expand Up @@ -5963,7 +6007,7 @@ __metadata:
languageName: node
linkType: hard

"lodash@npm:^4.17.21":
"lodash@npm:4.17.21, lodash@npm:^4.17.21":
version: 4.17.21
resolution: "lodash@npm:4.17.21"
checksum: d8cbea072bb08655bb4c989da418994b073a608dffa608b09ac04b43a791b12aeae7cd7ad919aa4c925f33b48490b5cfe6c1f71d827956071dae2e7bb3a6b74c
Expand Down Expand Up @@ -7151,6 +7195,7 @@ __metadata:
"@nestjs/core": "npm:^10.0.0"
"@nestjs/platform-express": "npm:^10.0.0"
"@nestjs/schematics": "npm:^10.0.0"
"@nestjs/swagger": "npm:^7.1.14"
"@nestjs/testing": "npm:^10.0.0"
"@nestjs/typeorm": "npm:^10.0.0"
"@types/express": "npm:^4.17.17"
Expand Down Expand Up @@ -8164,6 +8209,13 @@ __metadata:
languageName: node
linkType: hard

"swagger-ui-dist@npm:5.9.0":
version: 5.9.0
resolution: "swagger-ui-dist@npm:5.9.0"
checksum: e01c78d48dc6aa27049e218ebf6d6f16663c742eba6933788620a1b1d07187df9d48c85d963a6528245fc4af6b8362e42e2475b2eacb25b89c13165e42ac1454
languageName: node
linkType: hard

"symbol-observable@npm:4.0.0":
version: 4.0.0
resolution: "symbol-observable@npm:4.0.0"
Expand Down

0 comments on commit 109ad27

Please sign in to comment.