From 05b608e44cc6cce887638c56ff2936f48720e50b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B8=85=E6=B5=81?= Date: Thu, 2 Dec 2021 14:08:00 +0800 Subject: [PATCH] Update README.MD --- README.MD | 89 +++---------------------------------------------------- 1 file changed, 4 insertions(+), 85 deletions(-) diff --git a/README.MD b/README.MD index 4d994df..18b1c91 100644 --- a/README.MD +++ b/README.MD @@ -1,88 +1,7 @@ -# swagger服务 +# swagger -## 依赖 +## 直接下载包,获取dist目录中的文件,替换index.html即可 - - [go-frame](https://goframe.org) +https://github.com/swagger-api/swagger-ui/releases -## 安装构建 - -``` -go mod tidy -gf build main.go -mv bin/linux_amd64/swg /var/www/matrix -mv resource/index.html /var/www/matrix -``` - -## 目录结构 -```bash -[root@localhost swagger]# tree -. -├── index.html -├── runtime -│   └── server -│   └── 2021-05-26.log -├── swagger -│   └── swagger.json -└── swg - -3 directories, 4 files -``` - -## 基于supervisor进程守护 - -```ini -[program:swg] -directory=/var/www/matrix -command=/var/www/matrix/swg -user=root -autostart=true -autorestart=true -startsecs=3 -startretries=3 -stderr_logfile=/var/log/supervisor/swg-err.log -stdout_logfile=/var/log/supervisor/swg-out.log -``` - -## nginx代理 - -```nginx configuration -server { - listen 80; - server_name swagger.domain-example.com; - client_max_body_size 10m; - - location / { - proxy_pass http://127.0.0.1:8009; - proxy_read_timeout 30s; - proxy_redirect off; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - } -} -``` - -## 如果需要配置swagger密码 - -```go - -// router/router.go - -package router - -import ( - "github.com/gogf/gf/frame/g" - "github.com/gogf/gf/net/ghttp" - "github.com/gogf/swagger" - "swagger/app/api" -) - -func init() { - s := g.Server() - s.Group("/", func(group *ghttp.RouterGroup) { - group.ALL("/", api.Hello) - }) - s.Plugin(&swagger.Swagger{ - BasicAuthUser: "username-placeholder", - BasicAuthPass: "password-placeholder", - }) -} -``` \ No newline at end of file +## 修改index.html中的内容