-
Notifications
You must be signed in to change notification settings - Fork 5
/
route.go
57 lines (46 loc) · 1.59 KB
/
route.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package pulse
import (
"net/http"
)
type Route struct {
Method string
Path string
Handlers []Handler
ParamNames []string
}
// Get adds the route to the router with the GET method
func (r *Router) Get(path string, handlers ...Handler) {
r.Add(http.MethodGet, path, handlers...)
}
// Post adds the route to the router with the POST method
func (r *Router) Post(path string, handlers ...Handler) {
r.Add(http.MethodPost, path, handlers...)
}
// Put adds the route to the router with the PUT method
func (r *Router) Put(path string, handlers ...Handler) {
r.Add(http.MethodPut, path, handlers...)
}
// Delete adds the route to the router with the DELETE method
func (r *Router) Delete(path string, handlers ...Handler) {
r.Add(http.MethodDelete, path, handlers...)
}
// Patch adds the route to the router with the PATCH method
func (r *Router) Patch(path string, handlers ...Handler) {
r.Add(http.MethodPatch, path, handlers...)
}
// Head adds the route to the router with the HEAD method
func (r *Router) Head(path string, handlers ...Handler) {
r.Add(http.MethodHead, path, handlers...)
}
// Options adds the route to the router with the OPTIONS method
func (r *Router) Options(path string, handlers ...Handler) {
r.Add(http.MethodOptions, path, handlers...)
}
// Connect adds the route to the router with the CONNECT method
func (r *Router) Connect(path string, handlers ...Handler) {
r.Add(http.MethodConnect, path, handlers...)
}
// Trace adds the route to the router with the TRACE method
func (r *Router) Trace(path string, handlers ...Handler) {
r.Add(http.MethodTrace, path, handlers...)
}