package
module
Version:
v0.0.2
Opens a new window with list of versions in this module.
Published: Jun 20, 2023
License: Apache-2.0
Opens a new window with license information.
Imports: 7
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
Knife4g
use knife4j-front to show the api documents for iris
Usage
- 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
example:
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
Acknowledgement
Thanks to knife4j
Thanks to knife4g
Documentation
¶
func Handler(config Config) iris.Handler
type Config struct {
RelativePath string
SwaggerVersion string
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.