router

package
v0.0.0-...-d22e7c3 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2020 License: GPL-3.0 Imports: 7 Imported by: 0

README

Router

Is a wrapper for Gorilla mux

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainedMiddlewares

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

ChainedMiddlewares type

func NewChainedMiddleware

func NewChainedMiddleware(r *Router, middlewares ...MiddlewareFunc) *ChainedMiddlewares

NewChainedMiddleware function

func (*ChainedMiddlewares) Delete

func (cmw *ChainedMiddlewares) Delete(path string, handler HandlerFunc)

Delete right from router

func (*ChainedMiddlewares) Get

func (cmw *ChainedMiddlewares) Get(path string, handler HandlerFunc)

Get right from router

func (*ChainedMiddlewares) Head

func (cmw *ChainedMiddlewares) Head(path string, handler HandlerFunc)

Head right from router

func (*ChainedMiddlewares) Options

func (cmw *ChainedMiddlewares) Options(path string, handler HandlerFunc)

Options right from router

func (*ChainedMiddlewares) Patch

func (cmw *ChainedMiddlewares) Patch(path string, handler HandlerFunc)

Patch right from router

func (*ChainedMiddlewares) Post

func (cmw *ChainedMiddlewares) Post(path string, handler HandlerFunc)

Post right from router

func (*ChainedMiddlewares) Then

func (cmw *ChainedMiddlewares) Then(method, path string, handler HandlerFunc)

Then function

type HandlerFunc

type HandlerFunc func(ctx *requestcontext.RequestContext) error

HandlerFunc to handle http request

type MiddlewareFunc

type MiddlewareFunc func(HandlerFunc) HandlerFunc

MiddlewareFunc to handle middleware chaining

func (MiddlewareFunc) Next

func (mw MiddlewareFunc) Next(handler HandlerFunc) HandlerFunc

Next function

type Options

type Options struct {
	Debug bool
}

Options of router

type Router

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

Router struct

func New

func New(address string, options *Options) *Router

New router

func (*Router) Delete

func (r *Router) Delete(path string, handler HandlerFunc)

Delete function

func (*Router) Get

func (r *Router) Get(path string, handler HandlerFunc)

Get function

func (*Router) Handle

func (r *Router) Handle(path string, handler http.Handler)

Handle request with pure http handler

func (*Router) HandleFunc

func (r *Router) HandleFunc(method, path string, handler HandlerFunc)

HandleFunc function

func (*Router) Head

func (r *Router) Head(path string, handler HandlerFunc)

Head function

func (*Router) Options

func (r *Router) Options(path string, handler HandlerFunc)

Options function

func (*Router) Patch

func (r *Router) Patch(path string, handler HandlerFunc)

Patch function

func (*Router) PathPrefix

func (r *Router) PathPrefix(tpl string) *mux.Route

PathPrefix implementation of mux router this function is not using custom handleRoute functions metrics/diagnostics will not exported from this method

func (*Router) Post

func (r *Router) Post(path string, handler HandlerFunc)

Post function

func (*Router) Routes

func (r *Router) Routes() []*mux.Route

Routes return list of route in the router

func (*Router) ServeHTTP

func (r *Router) ServeHTTP(writer http.ResponseWriter, request *http.Request)

ServeHTTP function

func (*Router) Use

func (r *Router) Use(middlewares ...MiddlewareFunc)

Use middleware

func (*Router) Vars

func (r *Router) Vars(req *http.Request) map[string]string

Vars return map of query parameters

Jump to

Keyboard shortcuts

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