echogger

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2018 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware() echo.MiddlewareFunc

Middleware creates a middleware to serve a documentation site

func MiddlewareWithConfig

func MiddlewareWithConfig(config Config) echo.MiddlewareFunc

MiddlewareWithConfig creates a middleware with options to serve a documentation site

Types

type Config

type Config struct {
	DocPath  string
	BasePath string
	Flavor   string
	SubPath  string
	JSONName string
	NoUI     bool
}

Config configures the echogger middlewares

func (*Config) EnsureDefaults

func (c *Config) EnsureDefaults()

EnsureDefaults in case some options are missing

Jump to

Keyboard shortcuts

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