Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
cxcy-scoresheet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MathWeb
cxcy-scoresheet
Commits
7a749a58
Commit
7a749a58
authored
May 21, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add swagger ui
parent
48b4ee09
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
508 additions
and
20 deletions
+508
-20
package-lock.json
package-lock.json
+474
-18
package.json
package.json
+10
-1
src/app.controller.ts
src/app.controller.ts
+12
-0
src/app.service.ts
src/app.service.ts
+1
-1
src/main.ts
src/main.ts
+11
-0
No files found.
package-lock.json
View file @
7a749a58
This diff is collapsed.
Click to expand it.
package.json
View file @
7a749a58
...
@@ -24,13 +24,21 @@
...
@@ -24,13 +24,21 @@
"
@nestjs/common
"
:
"
^7.5.1
"
,
"
@nestjs/common
"
:
"
^7.5.1
"
,
"
@nestjs/core
"
:
"
^7.5.1
"
,
"
@nestjs/core
"
:
"
^7.5.1
"
,
"
@nestjs/platform-express
"
:
"
^7.5.1
"
,
"
@nestjs/platform-express
"
:
"
^7.5.1
"
,
"
@nestjs/swagger
"
:
"
^4.8.0
"
,
"
@nestjs/typeorm
"
:
"
^7.1.5
"
,
"
axios
"
:
"
^0.21.1
"
,
"
axios
"
:
"
^0.21.1
"
,
"
class-transformer
"
:
"
^0.4.0
"
,
"
class-validator
"
:
"
^0.13.1
"
,
"
lodash
"
:
"
^4.17.21
"
,
"
md-to-pdf
"
:
"
^3.3.2
"
,
"
md-to-pdf
"
:
"
^3.3.2
"
,
"
moment
"
:
"
^2.29.1
"
,
"
moment
"
:
"
^2.29.1
"
,
"
mustache
"
:
"
^4.2.0
"
,
"
mustache
"
:
"
^4.2.0
"
,
"
mysql
"
:
"
^2.18.1
"
,
"
reflect-metadata
"
:
"
^0.1.13
"
,
"
reflect-metadata
"
:
"
^0.1.13
"
,
"
rimraf
"
:
"
^3.0.2
"
,
"
rimraf
"
:
"
^3.0.2
"
,
"
rxjs
"
:
"
^6.6.3
"
"
rxjs
"
:
"
^6.6.3
"
,
"
swagger-ui-express
"
:
"
^4.1.6
"
,
"
typeorm
"
:
"
^0.2.32
"
},
},
"devDependencies"
:
{
"devDependencies"
:
{
"
@nestjs/cli
"
:
"
^7.5.1
"
,
"
@nestjs/cli
"
:
"
^7.5.1
"
,
...
@@ -38,6 +46,7 @@
...
@@ -38,6 +46,7 @@
"
@nestjs/testing
"
:
"
^7.5.1
"
,
"
@nestjs/testing
"
:
"
^7.5.1
"
,
"
@types/express
"
:
"
^4.17.11
"
,
"
@types/express
"
:
"
^4.17.11
"
,
"
@types/jest
"
:
"
^26.0.15
"
,
"
@types/jest
"
:
"
^26.0.15
"
,
"
@types/lodash
"
:
"
^4.14.169
"
,
"
@types/mustache
"
:
"
^4.1.1
"
,
"
@types/mustache
"
:
"
^4.1.1
"
,
"
@types/node
"
:
"
^14.14.6
"
,
"
@types/node
"
:
"
^14.14.6
"
,
"
@types/supertest
"
:
"
^2.0.10
"
,
"
@types/supertest
"
:
"
^2.0.10
"
,
...
...
src/app.controller.ts
View file @
7a749a58
...
@@ -13,12 +13,24 @@ import {
...
@@ -13,12 +13,24 @@ import {
CxcyReturnMessage
,
CxcyReturnMessage
,
CxcyReturnMessageLike
,
CxcyReturnMessageLike
,
}
from
'
./messages/CxcyReturnMessage
'
;
}
from
'
./messages/CxcyReturnMessage
'
;
import
{
ApiBadRequestResponse
,
ApiHeader
,
ApiInternalServerErrorResponse
,
ApiOkResponse
,
ApiQuery
,
}
from
'
@nestjs/swagger
'
;
@
Controller
(
'
api
'
)
@
Controller
(
'
api
'
)
export
class
AppController
{
export
class
AppController
{
constructor
(
private
readonly
appService
:
AppService
)
{}
constructor
(
private
readonly
appService
:
AppService
)
{}
@
Get
(
'
user/report.pdf
'
)
@
Get
(
'
user/report.pdf
'
)
@
ApiHeader
({
name
:
'
Authorization
'
,
description
:
'
用户 token
'
})
@
ApiQuery
({
name
:
'
request_id
'
,
description
:
'
请求 id,直接返回。
'
})
@
ApiOkResponse
({
description
:
'
成功,会直接提供文件下载。
'
})
@
ApiBadRequestResponse
({
description
:
'
用户不存在或者没有登录。
'
})
@
ApiInternalServerErrorResponse
({
description
:
'
报告生成过程中出现问题。
'
})
async
getPdf
(
async
getPdf
(
@
Headers
(
'
Authorization
'
)
userToken
:
string
,
@
Headers
(
'
Authorization
'
)
userToken
:
string
,
@
Query
(
'
request_id
'
)
requestId
:
string
,
@
Query
(
'
request_id
'
)
requestId
:
string
,
...
...
src/app.service.ts
View file @
7a749a58
...
@@ -71,7 +71,7 @@ export class AppService {
...
@@ -71,7 +71,7 @@ export class AppService {
{
{
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// @ts-ignore
launch_options
:
{
args
:
[
'
--no-sandbox
'
,
'
--disable-setuid-sandbox
'
]
},
launch_options
:
{
args
:
[
'
--no-sandbox
'
]
},
},
},
);
);
return
content
;
return
content
;
...
...
src/main.ts
View file @
7a749a58
import
{
NestFactory
}
from
'
@nestjs/core
'
;
import
{
NestFactory
}
from
'
@nestjs/core
'
;
import
{
AppModule
}
from
'
./app.module
'
;
import
{
AppModule
}
from
'
./app.module
'
;
import
{
DocumentBuilder
,
SwaggerModule
}
from
'
@nestjs/swagger
'
;
async
function
bootstrap
()
{
async
function
bootstrap
()
{
const
app
=
await
NestFactory
.
create
(
AppModule
);
const
app
=
await
NestFactory
.
create
(
AppModule
);
app
.
enableCors
();
app
.
enableCors
();
const
documentConfig
=
new
DocumentBuilder
()
.
setTitle
(
'
cxcy-scoresheet
'
)
.
setDescription
(
'
创新创业报告生成模块
'
)
.
setVersion
(
'
1.0
'
)
.
build
();
const
document
=
SwaggerModule
.
createDocument
(
app
,
documentConfig
);
SwaggerModule
.
setup
(
'
docs
'
,
app
,
document
);
await
app
.
listen
(
3000
);
await
app
.
listen
(
3000
);
}
}
bootstrap
();
bootstrap
();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment