swagger.go 690 B

1234567891011121314151617181920
  1. package swagger
  2. import (
  3. "Cold_Logistic/docs"
  4. "github.com/gin-gonic/gin"
  5. swaggerFiles "github.com/swaggo/files"
  6. ginSwagger "github.com/swaggo/gin-swagger"
  7. )
  8. // RegisterSwagger 注册Swagger
  9. func RegisterSwagger(r *gin.Engine) {
  10. // API文档访问地址: http://host/swagger/index.html
  11. // 注解定义可参考 https://github.com/swaggo/swag#declarative-comments-format
  12. docs.SwaggerInfo.BasePath = "/clodLogistic/api/v1"
  13. docs.SwaggerInfo.Title = "冷链运输平台接口文档"
  14. docs.SwaggerInfo.Version = "1.0"
  15. docs.SwaggerInfo.Host = "localhost:8888"
  16. docs.SwaggerInfo.Schemes = []string{"http", "https"}
  17. r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
  18. }