rrouter

package
v0.0.0-...-bac8e5f Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegGlobalMiddleware

func RegGlobalMiddleware(mw Middleware)

func Var

func Var(r *http.Request, key string) string

func Vars

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

Types

type Middleware

type Middleware func(http.HandlerFunc) http.HandlerFunc

type Router

type Router struct {
	*httprouter.Router
	// contains filtered or unexported fields
}

func New

func New() *Router

func (*Router) DELETE

func (r *Router) DELETE(path string, handle http.HandlerFunc)

DELETE is a shortcut for router.Handle(http.MethodDelete, path, handle)

func (*Router) GET

func (r *Router) GET(path string, handle http.HandlerFunc)

GET is a shortcut for router.Handle(http.MethodGet, path, handle)

func (*Router) HEAD

func (r *Router) HEAD(path string, handle http.HandlerFunc)

HEAD is a shortcut for router.Handle(http.MethodHead, path, handle)

func (*Router) Handle

func (r *Router) Handle(method, path string, handle http.HandlerFunc)

Handle registers a new request handle with the given path and method.

For GET, POST, PUT, PATCH and DELETE requests the respective shortcut functions can be used.

This function is intended for bulk loading and to allow the usage of less frequently used, non-standardized or custom methods (e.g. for internal communication with a proxy).

func (*Router) OPTIONS

func (r *Router) OPTIONS(path string, handle http.HandlerFunc)

OPTIONS is a shortcut for router.Handle(http.MethodOptions, path, handle)

func (*Router) PATCH

func (r *Router) PATCH(path string, handle http.HandlerFunc)

PATCH is a shortcut for router.Handle(http.MethodPatch, path, handle)

func (*Router) POST

func (r *Router) POST(path string, handle http.HandlerFunc)

POST is a shortcut for router.Handle(http.MethodPost, path, handle)

func (*Router) PUT

func (r *Router) PUT(path string, handle http.HandlerFunc)

PUT is a shortcut for router.Handle(http.MethodPut, path, handle)

func (*Router) Subroute

func (r *Router) Subroute(prefix string, sub *Router)

func (*Router) Use

func (r *Router) Use(mw Middleware)

func (*Router) Wrap

func (r *Router) Wrap(fn http.HandlerFunc) http.HandlerFunc

Jump to

Keyboard shortcuts

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