doc(gin-swagger): update docments.
This commit is contained in:
@@ -13,7 +13,7 @@ gin middleware to automatically generate RESTful API documentation with Swagger
|
|||||||
1. Add comments to your API source code, [See Declarative Comments Format](https://github.com/swaggo/swag#declarative-comments-format).
|
1. Add comments to your API source code, [See Declarative Comments Format](https://github.com/swaggo/swag#declarative-comments-format).
|
||||||
2. Download [Swag](https://github.com/swaggo/swag) for Go by using:
|
2. Download [Swag](https://github.com/swaggo/swag) for Go by using:
|
||||||
```sh
|
```sh
|
||||||
$ go get -u github.com/swaggo/swag
|
$ go get github.com/swaggo/swag/cmd/swag
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Run the [Swag](https://github.com/swaggo/swag) in your Go project root folder which contains `main.go` file, [Swag](https://github.com/swaggo/swag) will parse comments and generate required files(`docs` folder and `docs/doc.go`).
|
3. Run the [Swag](https://github.com/swaggo/swag) in your Go project root folder which contains `main.go` file, [Swag](https://github.com/swaggo/swag) will parse comments and generate required files(`docs` folder and `docs/doc.go`).
|
||||||
@@ -57,7 +57,8 @@ import (
|
|||||||
// @BasePath /v2
|
// @BasePath /v2
|
||||||
func main() {
|
func main() {
|
||||||
r := gin.New()
|
r := gin.New()
|
||||||
|
|
||||||
|
// use ginSwagger middleware to
|
||||||
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
|
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
|
||||||
|
|
||||||
r.Run()
|
r.Run()
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ import (
|
|||||||
"github.com/swaggo/swag"
|
"github.com/swaggo/swag"
|
||||||
)
|
)
|
||||||
|
|
||||||
// WrapHandler wraps `http.Handler` into `echo.HandlerFunc`.
|
// WrapHandler wraps `http.Handler` into `gin.HandlerFunc`.
|
||||||
func WrapHandler(h *webdav.Handler) gin.HandlerFunc {
|
func WrapHandler(h *webdav.Handler) gin.HandlerFunc {
|
||||||
//create a template with name
|
//create a template with name
|
||||||
t := template.New("swagger_index.html")
|
t := template.New("swagger_index.html")
|
||||||
|
|||||||
Reference in New Issue
Block a user