liuyuqi-cnb 2 months ago
parent
commit
f19597da17
5 changed files with 13 additions and 16 deletions
  1. 4 0
      README.md
  2. 5 5
      back-go/docs/docs.go
  3. 1 6
      back-go/docs/swagger.json
  4. 0 5
      back-go/docs/swagger.yaml
  5. 3 0
      back-go/service/service.go

+ 4 - 0
README.md

@@ -99,6 +99,10 @@ yarn  serve
 
 
 4、后端构建:
 4、后端构建:
 ```
 ```
+	
+go get -u github.com/swaggo/swag/cmd/swag
+
+
 go mod init
 go mod init
 go mod tidy
 go mod tidy
 go mod vendor
 go mod vendor

+ 5 - 5
back-go/docs/docs.go

@@ -101,12 +101,12 @@ const docTemplate = `{
 
 
 // SwaggerInfo holds exported Swagger Info so clients can modify it
 // SwaggerInfo holds exported Swagger Info so clients can modify it
 var SwaggerInfo = &swag.Spec{
 var SwaggerInfo = &swag.Spec{
-	Version:          "1.0",
-	Host:             "localhost:8080",
-	BasePath:         "/api",
+	Version:          "",
+	Host:             "",
+	BasePath:         "",
 	Schemes:          []string{},
 	Schemes:          []string{},
-	Title:            "FileCloud API",
-	Description:      "FileCloud API documentation",
+	Title:            "",
+	Description:      "",
 	InfoInstanceName: "swagger",
 	InfoInstanceName: "swagger",
 	SwaggerTemplate:  docTemplate,
 	SwaggerTemplate:  docTemplate,
 	LeftDelim:        "{{",
 	LeftDelim:        "{{",

+ 1 - 6
back-go/docs/swagger.json

@@ -1,13 +1,8 @@
 {
 {
     "swagger": "2.0",
     "swagger": "2.0",
     "info": {
     "info": {
-        "description": "FileCloud API documentation",
-        "title": "FileCloud API",
-        "contact": {},
-        "version": "1.0"
+        "contact": {}
     },
     },
-    "host": "localhost:8080",
-    "basePath": "/api",
     "paths": {
     "paths": {
         "/api/files": {
         "/api/files": {
             "get": {
             "get": {

+ 0 - 5
back-go/docs/swagger.yaml

@@ -1,4 +1,3 @@
-basePath: /api
 definitions:
 definitions:
   model.File:
   model.File:
     properties:
     properties:
@@ -17,12 +16,8 @@ definitions:
       updated_at:
       updated_at:
         type: string
         type: string
     type: object
     type: object
-host: localhost:8080
 info:
 info:
   contact: {}
   contact: {}
-  description: FileCloud API documentation
-  title: FileCloud API
-  version: "1.0"
 paths:
 paths:
   /api/files:
   /api/files:
     get:
     get:

+ 3 - 0
back-go/service/service.go

@@ -76,6 +76,9 @@ func Launch() {
 	// 注册 Swagger 路由
 	// 注册 Swagger 路由
 	app.GET("/swagger/*any", ginSwagger.WrapHandler(ginSwaggerFiles.Handler))
 	app.GET("/swagger/*any", ginSwagger.WrapHandler(ginSwaggerFiles.Handler))
 
 
+	// 静态资源嵌入与服务
+	app.StaticFS("/", http.FS(embeddedFiles))
+
 	initHandler(app)
 	initHandler(app)
 
 
 	port := strings.Split(config.WebAddr, ":")[1]
 	port := strings.Split(config.WebAddr, ":")[1]