webrouter

package
v0.0.0-...-2e22fb2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ReflectTypeInt    = reflect.TypeOf(int(1)) // TODO
	ReflectTypeString = reflect.TypeOf("")
)

Functions

func GetAPIDoc

func GetAPIDoc() string

func KeyFromRequestURI

func KeyFromRequestURI(uri string) string

func LoggingMiddleware

func LoggingMiddleware(next http.Handler) http.Handler

type MiddlewareFunc func(http.Handler) http.Handler must register before body-reading method

func ReadBodyMiddleware

func ReadBodyMiddleware(next http.Handler) http.Handler

func RegisterAPI

func RegisterAPI(r *mux.Router, apis []API)

func SetErrResponseFunc

func SetErrResponseFunc(f func(http.ResponseWriter, error))

Types

type API

type API struct {
	Method  string
	Path    string
	Func    func(http.ResponseWriter, *http.Request)
	Params  interface{}
	Example string
	Desc    string
}

Jump to

Keyboard shortcuts

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