use knife4j-front to show the api documents for iris
- 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/sin3degrees/knife4g
- Add router to your iris project
package main import ( "github.com/kataras/iris/v12" "github.com/sin3degrees/knife4g" ) func main() { engine := iris.Default() engine.Get("/doc/*any", knife4g.Handler(knife4g.Config{RelativePath: "/doc", SwaggerVersion: "2.0"})) engine.Run(":80") }
- Visit http://localhost/doc/index