Documentation ¶
Index ¶
- func RegGlobalMiddleware(mw Middleware)
- func Var(r *http.Request, key string) string
- func Vars(r *http.Request) map[string]string
- type Middleware
- type Router
- func (r *Router) DELETE(path string, handle http.HandlerFunc)
- func (r *Router) GET(path string, handle http.HandlerFunc)
- func (r *Router) HEAD(path string, handle http.HandlerFunc)
- func (r *Router) Handle(method, path string, handle http.HandlerFunc)
- func (r *Router) OPTIONS(path string, handle http.HandlerFunc)
- func (r *Router) PATCH(path string, handle http.HandlerFunc)
- func (r *Router) POST(path string, handle http.HandlerFunc)
- func (r *Router) PUT(path string, handle http.HandlerFunc)
- func (r *Router) Subroute(prefix string, sub *Router)
- func (r *Router) Use(mw Middleware)
- func (r *Router) Wrap(fn http.HandlerFunc) http.HandlerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegGlobalMiddleware ¶
func RegGlobalMiddleware(mw Middleware)
Types ¶
type Middleware ¶
type Middleware func(http.HandlerFunc) http.HandlerFunc
type Router ¶
type Router struct { *httprouter.Router // contains filtered or unexported fields }
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) Use ¶
func (r *Router) Use(mw Middleware)
func (*Router) Wrap ¶
func (r *Router) Wrap(fn http.HandlerFunc) http.HandlerFunc