4 Star 0 Fork 0

广州比力信息技术有限公司 / go_gin_swagger

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
main.go 869 Bytes
一键复制 编辑 原始数据 按行查看 历史
mouse 提交于 2023-02-10 14:12 . fix
package main
import (
"github.com/gin-contrib/gzip"
"github.com/gin-gonic/gin"
swaggerFiles "github.com/swaggo/files"
"github.com/swaggo/gin-swagger"
_ "github.com/swaggo/gin-swagger/example/basic/docs"
)
// @title Swagger Example API
// @version 1.0
// @description This is a sample server Petstore server.
// @termsOfService http://swagger.io/terms/
// @contact.name API Support
// @contact.url http://www.swagger.io/support
// @contact.email support@swagger.io
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
// @host petstore.swagger.io
// @BasePath /v2
func main() {
r := gin.New()
r.Use(gzip.Gzip(gzip.BestSpeed))
url := ginSwagger.URL("http://localhost:8080/swagger/doc.json") // The url pointing to API definition
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler, url))
r.Run()
}
1
https://gitee.com/infobili/gin-swagger.git
git@gitee.com:infobili/gin-swagger.git
infobili
gin-swagger
go_gin_swagger
198b4e5e46f1

搜索帮助