simpleapi

package
v0.0.0-...-fcff741 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONHandler

func JSONHandler(handler http.HandlerFunc) http.HandlerFunc

Types

type Endpoint

type Endpoint struct {
	Pattern     string
	Description string
	Method      string
	HandlerFunc http.HandlerFunc
}

func (*Endpoint) MarshalJSON

func (ep *Endpoint) MarshalJSON() ([]byte, error)

type MiddleWare

type MiddleWare func(handler http.HandlerFunc) http.HandlerFunc

type SimpleApi

type SimpleApi struct {
	// contains filtered or unexported fields
}

func New

func New(prefix string, apiEndpoints ...*Endpoint) *SimpleApi

func (*SimpleApi) AddMiddlewares

func (api *SimpleApi) AddMiddlewares(middlewares ...MiddleWare)

func (*SimpleApi) DocumentationHandler

func (api *SimpleApi) DocumentationHandler(w http.ResponseWriter, req *http.Request)

func (*SimpleApi) EnableDocumentation

func (api *SimpleApi) EnableDocumentation(route string)

func (*SimpleApi) InitRouter

func (api *SimpleApi) InitRouter()

func (*SimpleApi) ServeHTTP

func (api *SimpleApi) ServeHTTP(w http.ResponseWriter, request *http.Request)

func (*SimpleApi) Set404Handler

func (api *SimpleApi) Set404Handler(handler http.HandlerFunc)

Jump to

Keyboard shortcuts

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