use knife4j-front to show the api documents for gin
- Add comments to your API source code
- Download Swag for Go by using:
- Run
swag init -ot json
in your project directory - Run
go get github.com/hononet639/knife4g
- Add router to your gin project
package main import ( "github.com/gin-gonic/gin" "github.com/hononet639/knife4g" ) func main() { engine := gin.Default() engine.GET("/doc/*any", knife4g.Handler(knife4g.Config{RelativePath: "/doc"})) engine.Run(":80") }
- Visit http://localhost/doc/index
Thanks to knife4j