Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/go-chi/chi
/ functions
Functions
435 in github.com/go-chi/chi
⨍
Functions
435
◇
Types & classes
60
↓ 103 callers
Method
Get
(pattern string, h http.HandlerFunc)
chi.go:99
↓ 87 callers
Method
Write
(status, bytes int, header http.Header, elapsed time.Duration, extra interface{})
middleware/logger.go:70
↓ 72 callers
Method
HandlerFunc
HandlerFunc builds and returns a http.Handler from the chain of middlewares, with `h http.Handler` as the final handler.
chain.go:18
↓ 72 callers
Method
ServeHTTP
ServeHTTP is the single method of the http.Handler interface that makes Mux interoperable with the standard library. It uses a sync.Pool to get and re
mux.go:63
↓ 56 callers
Method
Close
()
middleware/compress.go:379
↓ 51 callers
Method
Use
Use appends one or more middlewares onto the Router stack.
chi.go:71
↓ 47 callers
Function
NewRouter
NewRouter returns a new Mux object that implements the Router interface.
chi.go:60
↓ 32 callers
Method
WriteHeader
(code int)
middleware/wrap_writer.go:82
↓ 30 callers
Function
testRequest
(t *testing.T, ts *httptest.Server, method, path string, body io.Reader)
mux_test.go:2038
↓ 28 callers
Method
Route
Route mounts a sub-Router along a `pattern` string.
chi.go:81
↓ 25 callers
Method
Add
Add will append a URL parameter to the end of the route param
context.go:152
↓ 23 callers
Method
Value
(method methodTyp)
tree.go:139
↓ 14 callers
Function
URLParam
URLParam returns the url parameter from a http.Request object.
context.go:10
↓ 13 callers
Function
NewRouteContext
NewRouteContext returns a new routing Context object.
context.go:33
↓ 13 callers
Method
handle
handle registers a http.Handler in the routing tree for a particular http method and routing pattern.
mux.go:422
↓ 13 callers
Function
run
run invokes mw with the request constructed by buildReq and returns the client IP captured inside the handler (or "" if none was set).
middleware/client_ip_test.go:706
↓ 12 callers
Method
NotFound
NotFound defines a handler to respond whenever a route could not be found.
chi.go:110
↓ 12 callers
Method
URLParam
URLParam returns the corresponding URL parameter value from the request routing context.
context.go:100
↓ 12 callers
Function
assertEqual
(t *testing.T, a, b interface{})
middleware/middleware_test.go:149
↓ 11 callers
Function
ClientIPFromXFF
ClientIPFromXFF stores the client IP read from the X-Forwarded-For header, walking the chain right-to-left and skipping any IP that falls within one o
middleware/client_ip.go:92
↓ 11 callers
Method
Mount
Mount attaches another http.Handler along ./pattern/*
chi.go:84
↓ 10 callers
Method
Post
(pattern string, h http.HandlerFunc)
chi.go:103
↓ 10 callers
Method
String
()
middleware/middleware.go:21
↓ 10 callers
Function
testRequest
(t *testing.T, ts *httptest.Server, method, path string, body io.Reader)
middleware/middleware_test.go:82
↓ 9 callers
Function
GetClientIP
GetClientIP returns the client IP as a string, as set by one of the ClientIPFrom* middlewares. Returns "" if no valid IP was set. Convenient for loggi
middleware/client_ip.go:203
↓ 8 callers
Method
FindRoute
(rctx *Context, method methodTyp, path string)
tree.go:383
↓ 8 callers
Method
InsertRoute
(method methodTyp, pattern string, handler http.Handler)
tree.go:148
↓ 7 callers
Method
Reset
(w io.Writer)
middleware/compress.go:270
↓ 7 callers
Method
With
With adds inline middlewares for an endpoint handler.
chi.go:74
↓ 7 callers
Function
assertNoError
(t *testing.T, err error)
middleware/middleware_test.go:135
↓ 6 callers
Function
ClientIPFromHeader
ClientIPFromHeader stores the client IP from a single-IP header set by your reverse proxy. Read it with [GetClientIP]. Only safe with headers your pr
middleware/client_ip.go:41
↓ 6 callers
Method
Group
Group adds a new inline-Router along the current routing path, with a fresh middleware stack for the inline-Router.
chi.go:78
↓ 6 callers
Method
HandleFunc
(pattern string, h http.HandlerFunc)
chi.go:89
↓ 6 callers
Method
Match
Match searches the routing tree for a handler that matches the method/path - similar to routing a http request, but without executing the handler ther
chi.go:129
↓ 6 callers
Method
Put
(pattern string, h http.HandlerFunc)
chi.go:104
↓ 6 callers
Method
Render
(w http.ResponseWriter, r *http.Request)
_examples/rest/main.go:305
↓ 6 callers
Method
ServeHTTP
(w http.ResponseWriter, r *http.Request)
_examples/custom-handler/main.go:12
↓ 5 callers
Method
Flush
()
middleware/compress.go:346
↓ 5 callers
Method
Handle
Handle and HandleFunc adds routes for `pattern` that matches all HTTP methods.
chi.go:88
↓ 5 callers
Method
Head
(pattern string, h http.HandlerFunc)
chi.go:100
↓ 5 callers
Function
NewArticleResponse
(article *Article)
_examples/rest/main.go:360
↓ 5 callers
Function
ThrottleBacklog
ThrottleBacklog is a middleware that limits number of currently processed requests at a time and provides a backlog for holding a finite number of pen
middleware/throttle.go:39
↓ 5 callers
Function
Walk
Walk walks any router tree that implements Routes interface.
tree.go:882
↓ 5 callers
Function
cW
colorWrite
middleware/terminal.go:55
↓ 5 callers
Method
writer
()
middleware/compress.go:338
↓ 4 callers
Function
Chain
Chain returns a Middlewares type from a slice of middleware handlers.
chain.go:6
↓ 4 callers
Method
Delete
(pattern string, h http.HandlerFunc)
chi.go:98
↓ 4 callers
Method
MethodFunc
(method, pattern string, h http.HandlerFunc)
chi.go:94
↓ 4 callers
Method
NotFoundHandler
NotFoundHandler returns the default Mux 404 responder whenever a route cannot be found.
mux.go:404
↓ 4 callers
Function
RouteContext
RouteContext returns chi's routing Context object from a http.Request Context.
context.go:27
↓ 4 callers
Method
Status
Status returns the HTTP status of the request, or 0 if one has not yet been sent.
middleware/wrap_writer.go:52
↓ 4 callers
Function
ThrottleWithOpts
ThrottleWithOpts is a middleware that limits number of currently processed requests using passed ThrottleOpts.
middleware/throttle.go:44
↓ 4 callers
Function
stringSliceEqual
(a, b []string)
tree_test.go:477
↓ 4 callers
Function
walkXFF
walkXFF walks the entries of the merged X-Forwarded-For chain RIGHT-TO-LEFT, invoking visit on each trimmed non-empty entry. visit returns true to sto
middleware/client_ip.go:228
↓ 3 callers
Method
BytesWritten
BytesWritten returns the total number of bytes sent to the client.
middleware/wrap_writer.go:54
↓ 3 callers
Function
ClientIPFromXFFTrustedProxies
ClientIPFromXFFTrustedProxies stores the client IP read from X-Forwarded-For, given the exact number of trusted reverse proxies between this server an
middleware/client_ip.go:149
↓ 3 callers
Function
ErrInvalidRequest
(err error)
_examples/rest/main.go:415
↓ 3 callers
Function
GetClientIPAddr
GetClientIPAddr returns the client IP as a [netip.Addr], as set by one of the ClientIPFrom* middlewares. The returned Addr is the zero value if not se
middleware/client_ip.go:215
↓ 3 callers
Method
MethodNotAllowed
MethodNotAllowed defines a handler to respond whenever a method is not allowed.
chi.go:114
↓ 3 callers
Function
NewCompressor
NewCompressor creates a new Compressor that will handle encoding responses. The level should be one of the ones defined in the flate package. The typ
middleware/compress.go:72
↓ 3 callers
Function
NewPattern
(value string)
middleware/route_headers.go:135
↓ 3 callers
Method
Print
(v ...interface{})
middleware/logger.go:88
↓ 3 callers
Method
Query
(pattern string, h http.HandlerFunc)
chi.go:105
↓ 3 callers
Method
RoutePattern
RoutePattern builds the routing pattern string for the particular request, at the particular point during routing. This means, the value will change t
context.go:123
↓ 3 callers
Method
Routes
Routes returns the routing tree in an easily traversable structure.
chi.go:121
↓ 3 callers
Method
String
()
mux_test.go:2072
↓ 3 callers
Function
chain
chain builds a http.Handler composed of an inline middleware stack and endpoint handler in the order they are passed.
chain.go:36
↓ 3 callers
Function
parseHeaderAddr
parseHeaderAddr parses s and normalizes for storage: v4-mapped IPv6 (::ffff:a.b.c.d) folds to plain v4, IPv6 zone is stripped. Both defend the trust-p
middleware/client_ip.go:268
↓ 3 callers
Function
patNextSegment
patNextSegment returns the next segment details from a pattern: node type, param key, regexp string, param tail byte, param starting index, param endi
tree.go:735
↓ 2 callers
Method
Bind
Bind on UserPayload will run after the unmarshalling is complete, its a good time to focus some post-processing after a decoding.
_examples/rest/main.go:301
↓ 2 callers
Method
BytesWritten
()
middleware/wrap_writer.go:126
↓ 2 callers
Function
ErrRender
(err error)
_examples/rest/main.go:424
↓ 2 callers
Method
Find
Find searches the routing tree for the pattern that matches the method/path.
chi.go:133
↓ 2 callers
Function
GetReqID
GetReqID returns a request ID from the given context if one is present. Returns the empty string if a request ID cannot be found.
middleware/request_id.go:83
↓ 2 callers
Method
Handler
Handler builds and returns a http.Handler from the chain of middlewares, with `h http.Handler` as the final handler.
chain.go:12
↓ 2 callers
Method
Handler
Handler returns a new middleware that will compress the response based on the current Compressor.
middleware/compress.go:199
↓ 2 callers
Method
Hijack
()
middleware/wrap_writer.go:160
↓ 2 callers
Method
Len
()
tree.go:835
↓ 2 callers
Method
Method
Method adds the route `pattern` that matches `method` http method to execute the `handler` http.Handler.
mux.go:127
↓ 2 callers
Method
Method
Method and MethodFunc adds routes for `pattern` that matches the `method` HTTP method.
chi.go:93
↓ 2 callers
Method
Mount
Mount attaches another http.Handler or chi Router as a subrouter along a routing path. It's very useful to split up a large API as many independent ro
mux.go:295
↓ 2 callers
Function
NewArticleListResponse
(articles []*Article)
_examples/rest/main.go:378
↓ 2 callers
Function
NewArticleResponse
(article *data.Article)
_examples/versions/presenter/v2/article.go:28
↓ 2 callers
Function
NewArticleResponse
(article *data.Article)
_examples/versions/presenter/v3/article.go:37
↓ 2 callers
Function
NewArticleResponse
(article *data.Article)
_examples/versions/presenter/v1/article.go:20
↓ 2 callers
Function
NewMux
NewMux returns a newly initialized Mux object that implements the Router interface.
mux.go:52
↓ 2 callers
Function
NewWrapResponseWriter
NewWrapResponseWriter wraps an http.ResponseWriter, returning a proxy that allows you to hook into various parts of the response process.
middleware/wrap_writer.go:15
↓ 2 callers
Method
ReadFrom
(r io.Reader)
middleware/wrap_writer.go:209
↓ 2 callers
Function
RequestLogger
RequestLogger returns a logger handler using a custom LogFormatter.
middleware/logger.go:44
↓ 2 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
↓ 2 callers
Method
SetEncoder
SetEncoder can be used to set the implementation of a compression algorithm. The encoding should be a standardised identifier. See: https://developer
middleware/compress.go:159
↓ 2 callers
Method
Tee
(w io.Writer)
middleware/wrap_writer.go:130
↓ 2 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
↓ 2 callers
Method
With
With adds inline middlewares for an endpoint handler.
mux.go:242
↓ 2 callers
Method
Write
(buf []byte)
middleware/wrap_writer.go:96
↓ 2 callers
Function
bigMux
()
mux_test.go:960
↓ 2 callers
Function
contentEncoding
Check the content encoding against a list of acceptable values.
middleware/content_charset.go:29
↓ 2 callers
Method
findEdge
(ntyp nodeTyp, label byte)
tree.go:559
↓ 2 callers
Method
findPattern
(pattern string)
tree.go:591
↓ 2 callers
Method
isLeaf
()
tree.go:587
next →
1–100 of 435, ranked by callers