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
↓ 1 callers
Method
Len
()
tree.go:806
↓ 1 callers
Method
MethodNotAllowedHandler
MethodNotAllowedHandler returns the default Mux 405 responder whenever a method cannot be resolved for a route.
mux.go:392
↓ 1 callers
Method
Middlewares
Middlewares returns the list of middlewares in use by the router.
chi.go:124
↓ 1 callers
Method
NewLogEntry
(r *http.Request)
middleware/logger.go:64
↓ 1 callers
Function
NewMux
NewMux returns a newly initialized Mux object that implements the Router interface.
mux.go:52
↓ 1 callers
Function
NewUserPayloadResponse
(user *User)
_examples/rest/main.go:295
↓ 1 callers
Method
Panic
(v interface{}, stack []byte)
middleware/logger.go:71
↓ 1 callers
Method
Post
Post adds the route `pattern` that matches a POST http method to execute the `handlerFn` http.HandlerFunc.
mux.go:185
↓ 1 callers
Method
Print
(v ...interface{})
middleware/logger.go:88
↓ 1 callers
Function
RegisterMethod
RegisterMethod adds support for custom HTTP method handlers, available via Router#Method and Router#MethodFunc
tree.go:60
↓ 1 callers
Method
Render
(w http.ResponseWriter, r *http.Request)
_examples/versions/presenter/v2/article.go:23
↓ 1 callers
Function
RequestLogger
RequestLogger returns a logger handler using a custom LogFormatter.
middleware/logger.go:44
↓ 1 callers
Method
Route
Route creates a new Mux and mounts it along the `pattern` as a subrouter. Effectively, this is a short-hand call to Mount. See _examples/.
mux.go:278
↓ 1 callers
Method
Sort
Sort the list of nodes by label
tree.go:805
↓ 1 callers
Function
StripSlashes
StripSlashes is a middleware that will match request paths with a trailing slash, strip it from the path and continue routing through the mux, if a ro
middleware/strip.go:13
↓ 1 callers
Function
Sunset
Sunset set Deprecation/Sunset header to response This can be used to enable Sunset in a route or a route group For more: https://www.rfc-editor.org/rf
middleware/sunset.go:11
↓ 1 callers
Method
Swap
(i, j int)
tree.go:807
↓ 1 callers
Function
Throttle
Throttle is a middleware that limits number of currently processed requests at a time across all users. Note: Throttle is not a rate-limiter per user,
middleware/throttle.go:31
↓ 1 callers
Function
Timeout
Timeout is a middleware that cancels ctx after a given timeout and return a 504 Gateway Timeout error to the client. It's required that you select th
middleware/timeout.go:32
↓ 1 callers
Function
URLParamFromCtx
URLParamFromCtx returns the url parameter from a http.Request Context.
context.go:18
↓ 1 callers
Method
Use
Use appends a middleware handler to the Mux middleware stack. The middleware stack for any Mux will execute before searching for a matching route to
mux.go:100
↓ 1 callers
Function
Walk
Walk walks any router tree that implements Routes interface.
tree.go:853
↓ 1 callers
Method
With
With adds inline middlewares for an endpoint handler.
mux.go:242
↓ 1 callers
Function
WithLogEntry
WithLogEntry sets the in-context LogEntry for a request.
middleware/logger.go:81
↓ 1 callers
Method
WriteHeader
(code int)
middleware/compress.go:296
↓ 1 callers
Method
addChild
addChild appends the new `child` node to the tree using the `pattern` as the trie key. For a URL router like chi's, we split the static, param, regexp
tree.go:233
↓ 1 callers
Function
adminRouter
A completely separate router for administrator routes
_examples/rest/main.go:219
↓ 1 callers
Function
apiVersionCtx
(version string)
_examples/versions/main.go:51
↓ 1 callers
Function
articleRouter
()
_examples/versions/main.go:60
↓ 1 callers
Function
assertError
(t *testing.T, err error)
middleware/middleware_test.go:143
↓ 1 callers
Function
basicAuthFailed
(w http.ResponseWriter, realm string)
middleware/basic_auth.go:30
↓ 1 callers
Function
dbGetArticle
(id string)
_examples/rest/main.go:475
↓ 1 callers
Function
dbGetArticleBySlug
(slug string)
_examples/rest/main.go:484
↓ 1 callers
Function
dbGetUser
(id int64)
_examples/rest/main.go:513
↓ 1 callers
Function
dbNewArticle
(article *Article)
_examples/rest/main.go:469
↓ 1 callers
Function
dbRemoveArticle
(id string)
_examples/rest/main.go:503
↓ 1 callers
Function
dbUpdateArticle
(id string, article *Article)
_examples/rest/main.go:493
↓ 1 callers
Function
decodeResponseBody
(t *testing.T, resp *http.Response)
middleware/compress_test.go:197
↓ 1 callers
Method
decorateFuncCallLine
(line string, useColor bool, num int)
middleware/recoverer.go:126
↓ 1 callers
Method
decorateLine
(line string, useColor bool, num int)
middleware/recoverer.go:112
↓ 1 callers
Method
decorateSourceLine
(line string, useColor bool, num int)
middleware/recoverer.go:166
↓ 1 callers
Method
findRoute
Recursive edge traversal by checking all nodeTyp groups along the way. It's like searching through a multi-dimensional radix trie.
tree.go:399
↓ 1 callers
Method
getEdge
(ntyp nodeTyp, label, tail byte, prefix string)
tree.go:329
↓ 1 callers
Method
isCompressible
()
middleware/compress.go:277
↓ 1 callers
Function
maintainDefaultRequestID
()
middleware/request_id_test.go:12
↓ 1 callers
Function
matchAcceptEncoding
(accepted []string, encoding string)
middleware/compress.go:243
↓ 1 callers
Function
methodNotAllowedHandler
methodNotAllowedHandler is a helper function to respond with a 405, method not allowed. It sets the Allow header with the list of allowed methods for
mux.go:500
↓ 1 callers
Function
methodTypString
(method methodTyp)
tree.go:793
↓ 1 callers
Method
parse
(debugStack []byte, rvr interface{})
middleware/recoverer.go:69
↓ 1 callers
Function
patParamKeys
(pattern string)
tree.go:759
↓ 1 callers
Function
realIP
(r *http.Request)
middleware/realip.go:42
↓ 1 callers
Method
replaceChild
(label, tail byte, child *node)
tree.go:317
↓ 1 callers
Function
replaceWildcards
replaceWildcards takes a route pattern and recursively replaces all occurrences of "/*/" to "/".
context.go:135
↓ 1 callers
Method
selectEncoder
selectEncoder returns the encoder, the name of the encoder, and a closer function.
middleware/compress.go:214
↓ 1 callers
Function
service
()
_examples/graceful/main.go:58
↓ 1 callers
Method
setEndpoint
(method methodTyp, handler http.Handler, pattern string)
tree.go:342
↓ 1 callers
Function
setPathValue
setPathValue sets the path values in the Request value based on the provided request context.
path_value.go:15
↓ 1 callers
Method
setRetryAfterHeaderIfNeeded
setRetryAfterHeaderIfNeeded sets Retry-After HTTP header if corresponding retryAfterFn option of throttler is initialized.
middleware/throttle.go:127
↓ 1 callers
Method
tailSort
tailSort pushes nodes with '/' as the tail to the end of the list for param nodes. The list order determines the traversal order.
tree.go:812
↓ 1 callers
Function
testHandler
(t *testing.T, h http.Handler, method, path string, body io.Reader)
mux_test.go:1868
↓ 1 callers
Function
testRequestNoRedirect
(t *testing.T, ts *httptest.Server, method, path string, body io.Reader)
middleware/middleware_test.go:106
↓ 1 callers
Function
testRequestWithAcceptedEncodings
(t *testing.T, ts *httptest.Server, method, path string, encodings ...string)
middleware/compress_test.go:174
↓ 1 callers
Function
walk
(r Routes, walkFn WalkFunc, parentRoute string, parentMw ...func(http.Handler) http.Handler)
tree.go:857
↓ 1 callers
Method
walk
(fn func(eps endpoints, subroutes Routes) bool)
tree.go:670
Function
AdminOnly
AdminOnly middleware restricts access to just administrators.
_examples/rest/main.go:235
Function
ArticleCtx
ArticleCtx middleware is used to load an Article object from the URL parameters passed through as the request. In case the Article could not be found,
_examples/rest/main.go:124
Function
BasicAuth
BasicAuth implements a simple middleware handler for adding basic http auth to a route.
middleware/basic_auth.go:10
Function
BenchmarkMux
(b *testing.B)
mux_test.go:1883
Function
BenchmarkTreeGet
(b *testing.B)
tree_test.go:487
Method
Bind
(r *http.Request)
_examples/rest/main.go:327
Function
CleanPath
CleanPath middleware will clean out double slash mistakes from a user's request path. For example, if a user requests /users//1 or //users////1 will b
middleware/clean_path.go:12
Function
Compress
Compress is a middleware that compresses response body of a given content types to a data format based on Accept-Encoding request header. It uses a gi
middleware/compress.go:41
Method
Connect
Connect adds the route `pattern` that matches a CONNECT http method to execute the `handlerFn` http.HandlerFunc.
mux.go:149
Method
Connect
HTTP-method routing along `pattern`
chi.go:98
Method
Create
(w http.ResponseWriter, r *http.Request)
_examples/todos-resource/users.go:34
Method
Create
(w http.ResponseWriter, r *http.Request)
_examples/todos-resource/todos.go:35
Function
CreateArticle
CreateArticle persists the posted Article and returns it back to the client as an acknowledgement.
_examples/rest/main.go:155
Method
Delete
Delete adds the route `pattern` that matches a DELETE http method to execute the `handlerFn` http.HandlerFunc.
mux.go:155
Method
Delete
(w http.ResponseWriter, r *http.Request)
_examples/todos-resource/users.go:46
Method
Delete
(w http.ResponseWriter, r *http.Request)
_examples/todos-resource/todos.go:47
Function
DeleteArticle
DeleteArticle removes an existing Article from our persistent store.
_examples/rest/main.go:201
Method
Discard
Discard causes all writes to the original ResponseWriter be discarded, instead writing only to the tee'd writer if it's set. The caller is responsible
middleware/wrap_writer.go:69
Method
Flush
()
middleware/wrap_writer.go:144
Method
Flush
()
middleware/wrap_writer.go:169
Method
Flush
()
middleware/compress.go:343
Method
Get
(w http.ResponseWriter, r *http.Request)
_examples/todos-resource/users.go:38
Method
Get
(w http.ResponseWriter, r *http.Request)
_examples/todos-resource/todos.go:39
Function
GetArticle
GetArticle returns the specific Article. You'll notice it just fetches the Article right off the context, as its understood that if we made it this fa
_examples/rest/main.go:173
Function
GetHead
GetHead automatically route undefined HEAD requests to GET handlers.
middleware/get_head.go:10
Method
Handle
Handle adds the route `pattern` that matches any http method to execute the `handler` http.Handler.
mux.go:109
Method
HandleFunc
HandleFunc adds the route `pattern` that matches any http method to execute the `handlerFn` http.HandlerFunc.
mux.go:121
Method
Handler
(next http.Handler)
middleware/route_headers.go:77
Method
Head
Head adds the route `pattern` that matches a HEAD http method to execute the `handlerFn` http.HandlerFunc.
mux.go:167
Function
Heartbeat
Heartbeat endpoint middleware useful to setting up a path like `/ping` that load balancers or uptime testing external services can make a request befo
middleware/heartbeat.go:12
Method
Hijack
()
middleware/wrap_writer.go:175
Method
Hijack
()
middleware/wrap_writer.go:197
Method
Hijack
()
middleware/logger_test.go:17
Method
Hijack
()
middleware/compress.go:359
Method
Less
(i, j int)
tree.go:808
Method
List
(w http.ResponseWriter, r *http.Request)
_examples/todos-resource/users.go:30
← previous
next →
101–200 of 372, ranked by callers