Deprecated: Please upgrade to the latest major version: go get github.com/go-chi/chi/v5
package chi
import "github.com/go-chi/chi"
Index ¶
- func URLParam(ctx context.Context, key string) string
- type Context
- type Handler
- type HandlerFunc
- func (h HandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (h HandlerFunc) ServeHTTPC(ctx context.Context, w http.ResponseWriter, r *http.Request)
- type Mux
- func NewMux() *Mux
- func NewRouter() *Mux
- func (mx *Mux) Connect(pattern string, handlers ...interface{})
- func (mx *Mux) Delete(pattern string, handlers ...interface{})
- func (mx *Mux) Get(pattern string, handlers ...interface{})
- func (mx *Mux) Group(fn func(r Router)) Router
- func (mx *Mux) Handle(pattern string, handlers ...interface{})
- func (mx *Mux) Head(pattern string, handlers ...interface{})
- func (mx *Mux) Mount(path string, handlers ...interface{})
- func (mx *Mux) NotFound(h HandlerFunc)
- func (mx *Mux) Options(pattern string, handlers ...interface{})
- func (mx *Mux) Patch(pattern string, handlers ...interface{})
- func (mx *Mux) Post(pattern string, handlers ...interface{})
- func (mx *Mux) Put(pattern string, handlers ...interface{})
- func (mx *Mux) Route(pattern string, fn func(r Router)) Router
- func (mx *Mux) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (mx *Mux) ServeHTTPC(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (mx *Mux) Trace(pattern string, handlers ...interface{})
- func (mx *Mux) Use(mws ...interface{})
- type Router
- type WalkFn
Functions ¶
func URLParam ¶
Types ¶
type Context ¶
func RootContext ¶
Returns the root level chi Context object
func (*Context) Param ¶
type Handler ¶
Handler is like net/http's http.Handler, but also includes a mechanism for serving requests with a context.
type HandlerFunc ¶
HandlerFunc is like net/http's http.HandlerFunc, but supports a context object.
func (HandlerFunc) ServeHTTP ¶
func (h HandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP provides compatibility with http.Handler.
func (HandlerFunc) ServeHTTPC ¶
func (h HandlerFunc) ServeHTTPC(ctx context.Context, w http.ResponseWriter, r *http.Request)
ServeHTTPC wraps ServeHTTP with a context parameter.
type Mux ¶
type Mux struct {
// contains filtered or unexported fields
}
func NewMux ¶
func NewMux() *Mux
func NewRouter ¶
func NewRouter() *Mux
func (*Mux) Connect ¶
func (*Mux) Delete ¶
func (*Mux) Get ¶
func (*Mux) Group ¶
func (*Mux) Handle ¶
func (*Mux) Head ¶
func (*Mux) Mount ¶
func (*Mux) NotFound ¶
func (mx *Mux) NotFound(h HandlerFunc)
NotFound sets a custom handler for the case when no routes match
func (*Mux) Options ¶
func (*Mux) Patch ¶
func (*Mux) Post ¶
func (*Mux) Put ¶
func (*Mux) Route ¶
func (*Mux) ServeHTTP ¶
func (mx *Mux) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*Mux) ServeHTTPC ¶
func (*Mux) Trace ¶
func (*Mux) Use ¶
func (mx *Mux) Use(mws ...interface{})
Append to the middleware stack
type Router ¶
type Router interface { http.Handler Handler Use(middlewares ...interface{}) Group(fn func(r Router)) Router Route(pattern string, fn func(r Router)) Router Mount(pattern string, handlers ...interface{}) Handle(pattern string, handlers ...interface{}) NotFound(h HandlerFunc) Connect(pattern string, handlers ...interface{}) Head(pattern string, handlers ...interface{}) Get(pattern string, handlers ...interface{}) Post(pattern string, handlers ...interface{}) Put(pattern string, handlers ...interface{}) Patch(pattern string, handlers ...interface{}) Delete(pattern string, handlers ...interface{}) Trace(pattern string, handlers ...interface{}) Options(pattern string, handlers ...interface{}) }
type WalkFn ¶
WalkFn is used when walking the tree. Takes a key and value, returning if iteration should be terminated.
Source Files ¶
chi.go context.go mux.go tree.go util.go
Directories ¶
Path | Synopsis |
---|---|
_examples | |
_examples/rest | |
_examples/simple | |
middleware | |
render |
- Version
- v0.9.0
- Published
- Mar 31, 2016
- Platform
- js/wasm
- Imports
- 6 packages
- Last checked
- 4 days ago –
Tools for package owners.