knife4g

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

README

Knife4g

use knife4j-front to show the api documents for iris

Usage

  1. Add comments to your API source code
  2. Download Swag for Go by using:
  3. Run swag init -ot json in your project directory
  4. Run go get github.com/sin3degrees/knife4g
  5. 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")
    }
    
  6. Visit http://localhost/doc/index

Acknowledgement

Thanks to knife4j Thanks to knife4g

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(config Config) iris.Handler

Types

type Config

type Config struct {
	RelativePath   string
	SwaggerVersion string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL