Categorygithub.com/KimMachineGun/echogger
modulepackage
1.1.0
Repository: https://github.com/kimmachinegun/echogger.git
Documentation: pkg.go.dev

# README

echogger Build Status Go Report Card

Easy Swagger UI for your Echo API

Installation

go get -u github.com/KimMachineGun/echogger

Example

package main

import (
	"net/http"

	"github.com/KimMachineGun/echogger"

	"github.com/labstack/echo"
)

const PORT = "8080"

func main() {
	e := echo.New()

	config := echogger.Config{
		Flavor:   "swagger",
		BasePath: "v1",
		SubPath:  "document",
		DocPath:  "./swagger.yaml",
		JSONName: "spec.json",
	}

	e.Use(echogger.MiddlewareWithConfig(config))

	e.GET("/", func(c echo.Context) error {
		return c.String(http.StatusOK, "Hello world")
	})

	e.Start(":" + PORT)
}

If you use echogger.Middleware(), config is default value.

Default Value

Flavor:   "swagger"
BasePath: "/"
SubPath:  "docs"
DocPath:  "./swagger.yaml"
JSONName: "swagger.json"

# Functions

Middleware creates a middleware to serve a documentation site.
MiddlewareWithConfig creates a middleware with options to serve a documentation site.

# Structs

Config configures the echogger middlewares.