Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/go-chi/chi
/ functions
Functions
372 in github.com/go-chi/chi
⨍
Functions
372
◇
Types & classes
57
Method
List
(w http.ResponseWriter, r *http.Request)
_examples/todos-resource/todos.go:31
Function
ListArticles
(w http.ResponseWriter, r *http.Request)
_examples/rest/main.go:114
Function
Logger
Logger is a middleware that logs the start and end of each request, along with some useful data about what was requested, what the response status was
middleware/logger.go:39
Method
Match
Match searches the routing tree for a handler that matches the method/path. It's similar to routing a http request, but without executing the handler
mux.go:365
Method
Match
(v string)
middleware/route_headers.go:146
Function
Maybe
Maybe middleware will allow you to change the flow of the middleware stack execution depending on return value of maybeFn(request). This is useful for
middleware/maybe.go:8
Method
MethodFunc
MethodFunc adds the route `pattern` that matches `method` http method to execute the `handlerFn` http.HandlerFunc.
mux.go:143
Method
MethodNotAllowed
MethodNotAllowed sets a custom http.HandlerFunc for routing paths where the method is unresolved. The default handler returns a 405 with an empty body
mux.go:223
Method
Middlewares
Middlewares returns a slice of middleware handler functions.
mux.go:355
Function
New
New will create a new middleware handler from a http.Handler.
middleware/middleware.go:6
Method
NewLogEntry
NewLogEntry creates a new LogEntry for the request.
middleware/logger.go:98
Function
NextRequestID
NextRequestID generates the next request ID in the sequence.
middleware/request_id.go:94
Function
NoCache
NoCache is a simple piece of middleware that sets a number of HTTP headers to prevent a router (or subrouter) from being cached by an upstream proxy a
middleware/nocache.go:40
Method
NotFound
NotFound sets a custom http.HandlerFunc for routing paths that could not be found. The default 404 handler is `http.NotFound`.
mux.go:203
Method
Options
Options adds the route `pattern` that matches an OPTIONS http method to execute the `handlerFn` http.HandlerFunc.
mux.go:173
Method
Options
(pattern string, h http.HandlerFunc)
chi.go:102
Function
PageRoute
PageRoute is a simple middleware which allows you to route a static GET request at the middleware stack level.
middleware/page_route.go:10
Method
Panic
(v interface{}, stack []byte)
middleware/logger.go:162
Method
Patch
Patch adds the route `pattern` that matches a PATCH http method to execute the `handlerFn` http.HandlerFunc.
mux.go:179
Method
Patch
(pattern string, h http.HandlerFunc)
chi.go:103
Function
PathRewrite
PathRewrite is a simple middleware which allows you to rewrite the request URL path.
middleware/path_rewrite.go:9
Function
Ping
Ping returns pong
_examples/router-walk/main.go:40
Function
PresentError
(r *http.Request, err error)
_examples/versions/data/errors.go:16
Function
Profiler
Profiler is a convenient subrouter used for mounting net/http/pprof. ie. func MyService() http.Handler { r := chi.NewRouter() // ..middlewares
middleware/profiler.go:20
Method
Push
(target string, opts *http.PushOptions)
middleware/wrap_writer.go:202
Method
Push
(target string, opts *http.PushOptions)
middleware/compress.go:366
Method
Put
Put adds the route `pattern` that matches a PUT http method to execute the `handlerFn` http.HandlerFunc.
mux.go:191
Method
ReadFrom
(r io.Reader)
middleware/wrap_writer.go:206
Function
RealIP
RealIP is a middleware that sets a http.Request's RemoteAddr to the results of parsing either the True-Client-IP, X-Real-IP or the X-Forwarded-For hea
middleware/realip.go:31
Function
Recoverer
Recoverer is a middleware that recovers from panics, logs the panic (and a backtrace), and returns a HTTP 500 (Internal Server Error) status if possib
middleware/recoverer.go:22
Function
RedirectSlashes
RedirectSlashes is a middleware that will match request paths with a trailing slash and redirect to the same path, less the trailing slash. NOTE: Red
middleware/strip.go:40
Method
Render
(w http.ResponseWriter, r *http.Request)
_examples/versions/presenter/v3/article.go:25
Method
Render
(w http.ResponseWriter, r *http.Request)
_examples/versions/presenter/v1/article.go:16
Method
Render
(w http.ResponseWriter, r *http.Request)
_examples/rest/main.go:372
Method
Render
(w http.ResponseWriter, r *http.Request)
_examples/rest/main.go:410
Function
RequestID
RequestID is a middleware that injects a request ID into the context of each request. A request ID is a string of the form "host.example.com/random-00
middleware/request_id.go:67
Function
RequestSize
RequestSize is a middleware that will limit request sizes to a specified number of bytes. It uses MaxBytesReader to do so.
middleware/request_size.go:9
Method
Reset
Reset a routing context to its initial state.
context.go:82
Method
Route
(header, match string, middlewareHandler func(next http.Handler) http.Handler)
middleware/route_headers.go:48
Method
RouteAny
(header string, match []string, middlewareHandler func(next http.Handler) http.Handler)
middleware/route_headers.go:58
Method
RouteDefault
(handler func(next http.Handler) http.Handler)
middleware/route_headers.go:72
Function
RouteHeaders
RouteHeaders is a neat little header-based router that allows you to direct the flow of a request through a middleware stack based on a request header
middleware/route_headers.go:42
Method
Routes
Routes returns a slice of routing information from the tree, useful for traversing available routes of a router.
mux.go:350
Method
Routes
Routes creates a REST router for the todos resource
_examples/todos-resource/users.go:12
Method
Routes
Routes creates a REST router for the todos resource
_examples/todos-resource/todos.go:12
Function
SearchArticles
SearchArticles searches the Articles data for a matching article. It's just a stub, but you get the idea.
_examples/rest/main.go:149
Method
ServeHTTP
(w http.ResponseWriter, r *http.Request)
chain.go:30
Function
SetHeader
SetHeader is a convenience handler to set a response header key/value
middleware/content_type.go:9
Method
Status
()
middleware/wrap_writer.go:119
Method
String
()
context.go:160
Function
SupressNotFound
SupressNotFound will quickly respond with a 404 if the route is not found and will not continue to the next middleware handler. This is handy to put
middleware/supress_notfound.go:15
Method
Sync
(w http.ResponseWriter, r *http.Request)
_examples/todos-resource/todos.go:51
Method
Tee
Tee causes the response body to be written to the given io.Writer in addition to proxying the writes through. Only one io.Writer can be tee'd to at on
middleware/wrap_writer.go:62
Function
TestBasicWriterDiscardsWritesToOriginalResponseWriter
(t *testing.T)
middleware/wrap_writer_test.go:48
Function
TestBasicWritesTeesWritesWithoutDiscard
(t *testing.T)
middleware/wrap_writer_test.go:28
Function
TestCompressor
(t *testing.T)
middleware/compress_test.go:17
Function
TestCompressorWildcards
(t *testing.T)
middleware/compress_test.go:114
Function
TestContentCharset
(t *testing.T)
middleware/content_charset_test.go:11
Function
TestContentEncoding
(t *testing.T)
middleware/content_charset_test.go:113
Function
TestContentEncodingMiddleware
(t *testing.T)
middleware/content_encoding_test.go:12
Function
TestContentType
(t *testing.T)
middleware/content_type_test.go:12
Function
TestCustomHTTPMethod
(t *testing.T)
mux_test.go:1753
Function
TestEscapedURLParams
(t *testing.T)
mux_test.go:1713
Function
TestGetHead
(t *testing.T)
middleware/get_head_test.go:11
Function
TestHttp2FancyWriterRemembersWroteHeaderWhenFlushed
(t *testing.T)
middleware/wrap_writer_test.go:19
Function
TestHttpFancyWriterRemembersWroteHeaderWhenFlushed
(t *testing.T)
middleware/wrap_writer_test.go:10
Function
TestInvalidIP
(t *testing.T)
middleware/realip_test.go:93
Function
TestMethodNotAllowed
(t *testing.T)
mux_test.go:395
Function
TestMiddlewarePanicOnLateUse
(t *testing.T)
mux_test.go:1440
Function
TestMountingExistingPath
(t *testing.T)
mux_test.go:1462
Function
TestMountingSimilarPattern
(t *testing.T)
mux_test.go:1477
Function
TestMuxBasic
(t *testing.T)
mux_test.go:17
Function
TestMuxBig
(t *testing.T)
mux_test.go:877
Function
TestMuxComplicatedNotFound
(t *testing.T)
mux_test.go:498
Function
TestMuxContextIsThreadSafe
(t *testing.T)
mux_test.go:1677
Function
TestMuxEmptyParams
(t *testing.T)
mux_test.go:1504
Function
TestMuxEmptyRoutes
(t *testing.T)
mux_test.go:267
Function
TestMuxHandlePatternValidation
(t *testing.T)
mux_test.go:643
Function
TestMuxMatch
(t *testing.T)
mux_test.go:1779
Function
TestMuxMiddlewareStack
(t *testing.T)
mux_test.go:746
Function
TestMuxMissingParams
(t *testing.T)
mux_test.go:1524
Function
TestMuxMounts
(t *testing.T)
mux_test.go:209
Function
TestMuxNestedMethodNotAllowed
(t *testing.T)
mux_test.go:432
Function
TestMuxNestedNotFound
(t *testing.T)
mux_test.go:317
Function
TestMuxPlain
(t *testing.T)
mux_test.go:246
Function
TestMuxRegexp
(t *testing.T)
mux_test.go:1572
Function
TestMuxRegexp2
(t *testing.T)
mux_test.go:1588
Function
TestMuxRegexp3
(t *testing.T)
mux_test.go:1604
Function
TestMuxRouteGroups
(t *testing.T)
mux_test.go:821
Function
TestMuxSubrouterWildcardParam
(t *testing.T)
mux_test.go:1645
Function
TestMuxSubroutes
(t *testing.T)
mux_test.go:1169
Function
TestMuxSubroutesBasic
(t *testing.T)
mux_test.go:1088
Function
TestMuxTrailingSlash
Test a mux that routes a trailing slash, see also middleware/strip_test.go for an example of using a middleware to handle trailing slashes.
mux_test.go:286
Function
TestMuxWildcardRoute
(t *testing.T)
mux_test.go:1546
Function
TestMuxWildcardRouteCheckTwo
(t *testing.T)
mux_test.go:1559
Function
TestMuxWith
(t *testing.T)
mux_test.go:590
Function
TestNestedGroups
(t *testing.T)
mux_test.go:1384
Function
TestPathValue
(t *testing.T)
path_value_test.go:13
Function
TestRecoverer
(t *testing.T)
middleware/recoverer_test.go:15
Function
TestRecovererAbortHandler
(t *testing.T)
middleware/recoverer_test.go:44
← previous
next →
201–300 of 372, ranked by callers