File tree 2 files changed +45
-1
lines changed
2 files changed +45
-1
lines changed Original file line number Diff line number Diff line change 1
1
2
- # Swagger for Nest
2
+ # Swagger for Nest
3
+
4
+ ### Quick start
5
+
6
+ - install
7
+ ``` bash
8
+ npm install nest-swagger
9
+ ```
10
+
11
+ - add swagger.config.json
12
+ ``` bash
13
+ {
14
+ " swagger" : {
15
+ " outputDirectory" : " ./dist" ,
16
+ " entryFile" : " ./src/main.ts" ,
17
+ " name" : " your app name" ,
18
+ " description" : " description" ,
19
+ " license" : " MIT" ,
20
+ " produces" : [" application/json" ],
21
+ " version" : " 0.0.1"
22
+ }
23
+ }
24
+ ```
25
+ - add npm script
26
+ ```
27
+ "swagger": "swaggerGen -c ./swagger.config.json",
28
+ ```
29
+ - run npm script
30
+ ```
31
+ npm run swagger
32
+ ```
33
+ you can find the output generated ` swagger.json ` and ` swagger.yaml `
Original file line number Diff line number Diff line change @@ -39,6 +39,11 @@ class Address {
39
39
houseNumber : string ;
40
40
}
41
41
42
+ class KeyValueDto {
43
+ label : string ;
44
+ value : string ;
45
+ }
46
+
42
47
interface Query {
43
48
size : number ;
44
49
index : number ;
@@ -74,6 +79,14 @@ export class AppController {
74
79
return null ;
75
80
}
76
81
82
+ @Get ( 'search' )
83
+ async search (
84
+ @Query ( 'keyword' ) keyword ?: string ,
85
+ @Query ( 'value' ) value ?: string
86
+ ) : Promise < KeyValueDto [ ] > {
87
+ return null ;
88
+ }
89
+
77
90
@Get ( ':id' )
78
91
async findOne ( @Param ( 'id' ) id : string ) : Promise < User > {
79
92
return null ;
You can’t perform that action at this time.
0 commit comments