You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc.go
+12-13Lines changed: 12 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -10,18 +10,18 @@ http.ServeMux, mux.Router matches incoming requests against a list of
10
10
registered routes and calls a handler for the route that matches the URL
11
11
or other conditions. The main features are:
12
12
13
-
* Requests can be matched based on URL host, path, path prefix, schemes,
14
-
header and query values, HTTP methods or using custom matchers.
15
-
* URL hosts, paths and query values can have variables with an optional
16
-
regular expression.
17
-
* Registered URLs can be built, or "reversed", which helps maintaining
18
-
references to resources.
19
-
* Routes can be used as subrouters: nested routes are only tested if the
20
-
parent route matches. This is useful to define groups of routes that
21
-
share common conditions like a host, a path prefix or other repeated
22
-
attributes. As a bonus, this optimizes request matching.
23
-
* It implements the http.Handler interface so it is compatible with the
24
-
standard http.ServeMux.
13
+
- Requests can be matched based on URL host, path, path prefix, schemes,
14
+
header and query values, HTTP methods or using custom matchers.
15
+
- URL hosts, paths and query values can have variables with an optional
16
+
regular expression.
17
+
- Registered URLs can be built, or "reversed", which helps maintaining
18
+
references to resources.
19
+
- Routes can be used as subrouters: nested routes are only tested if the
20
+
parent route matches. This is useful to define groups of routes that
21
+
share common conditions like a host, a path prefix or other repeated
22
+
attributes. As a bonus, this optimizes request matching.
23
+
- It implements the http.Handler interface so it is compatible with the
24
+
standard http.ServeMux.
25
25
26
26
Let's start registering a couple of URL paths and handlers:
27
27
@@ -301,6 +301,5 @@ A more complex authentication middleware, which maps session token to users, cou
301
301
r.Use(amw.Middleware)
302
302
303
303
Note: The handler chain will be stopped if your middleware doesn't call `next.ServeHTTP()` with the corresponding parameters. This can be used to abort a request if the middleware writer wants to.
0 commit comments