chirouter

package
v0.2.27 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: MIT Imports: 5 Imported by: 7

Documentation

Overview

Package chirouter provides instrumentation for chi.Router.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PathToURLValues

func PathToURLValues(r *http.Request) (url.Values, error)

PathToURLValues is a decoder function for parameters in path.

Types

type Wrapper

type Wrapper struct {
	chi.Router
	// contains filtered or unexported fields
}

Wrapper wraps chi.Router to enable unwrappable handlers in middlewares.

Middlewares can call nethttp.HandlerAs to inspect wrapped handlers.

func NewWrapper

func NewWrapper(r chi.Router) *Wrapper

NewWrapper creates router wrapper to upgrade middlewares processing.

func (*Wrapper) Connect

func (r *Wrapper) Connect(pattern string, handlerFn http.HandlerFunc)

Connect adds the route `pattern` that matches a CONNECT http method to execute the `handlerFn` http.HandlerFunc.

func (*Wrapper) Delete

func (r *Wrapper) Delete(pattern string, handlerFn http.HandlerFunc)

Delete adds the route `pattern` that matches a DELETE http method to execute the `handlerFn` http.HandlerFunc.

func (*Wrapper) Get

func (r *Wrapper) Get(pattern string, handlerFn http.HandlerFunc)

Get adds the route `pattern` that matches a GET http method to execute the `handlerFn` http.HandlerFunc.

func (*Wrapper) Group

func (r *Wrapper) Group(fn func(r chi.Router)) chi.Router

Group adds a new inline-router along the current routing path, with a fresh middleware stack for the inline-router.

func (*Wrapper) Handle

func (r *Wrapper) Handle(pattern string, h http.Handler)

Handle adds routes for `basePattern` that matches all HTTP methods.

func (*Wrapper) Head

func (r *Wrapper) Head(pattern string, handlerFn http.HandlerFunc)

Head adds the route `pattern` that matches a HEAD http method to execute the `handlerFn` http.HandlerFunc.

func (*Wrapper) Method

func (r *Wrapper) Method(method, pattern string, h http.Handler)

Method adds routes for `basePattern` that matches the `method` HTTP method.

func (*Wrapper) MethodFunc

func (r *Wrapper) MethodFunc(method, pattern string, handlerFn http.HandlerFunc)

MethodFunc adds the route `pattern` that matches `method` http method to execute the `handlerFn` http.HandlerFunc.

func (*Wrapper) Mount

func (r *Wrapper) Mount(pattern string, h http.Handler)

Mount attaches another http.Handler along "./basePattern/*".

func (*Wrapper) Options

func (r *Wrapper) Options(pattern string, handlerFn http.HandlerFunc)

Options adds the route `pattern` that matches a OPTIONS http method to execute the `handlerFn` http.HandlerFunc.

func (*Wrapper) Patch

func (r *Wrapper) Patch(pattern string, handlerFn http.HandlerFunc)

Patch adds the route `pattern` that matches a PATCH http method to execute the `handlerFn` http.HandlerFunc.

func (*Wrapper) Post

func (r *Wrapper) Post(pattern string, handlerFn http.HandlerFunc)

Post adds the route `pattern` that matches a POST http method to execute the `handlerFn` http.HandlerFunc.

func (*Wrapper) Put

func (r *Wrapper) Put(pattern string, handlerFn http.HandlerFunc)

Put adds the route `pattern` that matches a PUT http method to execute the `handlerFn` http.HandlerFunc.

func (*Wrapper) Route

func (r *Wrapper) Route(pattern string, fn func(r chi.Router)) chi.Router

Route mounts a sub-router along a `basePattern` string.

func (*Wrapper) Trace

func (r *Wrapper) Trace(pattern string, handlerFn http.HandlerFunc)

Trace adds the route `pattern` that matches a TRACE http method to execute the `handlerFn` http.HandlerFunc.

func (*Wrapper) Use

func (r *Wrapper) Use(middlewares ...func(http.Handler) http.Handler)

Use appends one of more middlewares onto the Router stack.

func (Wrapper) With

func (r Wrapper) With(middlewares ...func(http.Handler) http.Handler) chi.Router

With adds inline middlewares for an endpoint handler.

Jump to

Keyboard shortcuts

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