fix working example/basic/api function (#123)

This commit is contained in:
Anton Dzyk
2020-08-03 14:17:43 +03:00
committed by GitHub
parent bbeaf5b73c
commit 4199ce8e17
4 changed files with 75 additions and 33 deletions
+7 -2
View File
@@ -5,6 +5,8 @@ import (
"github.com/swaggo/files"
"github.com/swaggo/gin-swagger"
"github.com/swaggo/gin-swagger/example/basic/api"
_ "github.com/swaggo/gin-swagger/example/basic/docs"
)
@@ -20,12 +22,15 @@ import (
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
// @host petstore.swagger.io
// @host petstore.swagger.io:8080
// @BasePath /v2
func main() {
r := gin.New()
url := ginSwagger.URL("http://localhost:8080/swagger/doc.json") // The url pointing to API definition
r.GET("/v2/testapi/get-string-by-int/:some_id", api.GetStringByInt)
r.GET("/v2/testapi/get-struct-array-by-string/:some_id", api.GetStructArrayByString)
url := ginSwagger.URL("http://petstore.swagger.io:8080/swagger/doc.json") // The url pointing to API definition
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler, url))
r.Run()