Skip to content

Commit e628764

Browse files
committed
Add other methods
1 parent 6f8962e commit e628764

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# router
1+
# router

router.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,34 @@ func (ro Router) ServeHTTP(w http.ResponseWriter, r *http.Request) {
2525
}
2626

2727
/* Methods functions */
28+
29+
// GET
2830
func (ro Router) Get(route string, cb func(w http.ResponseWriter, r *http.Request)){
2931
ro.routes[route] = cb
3032
fmt.Println("GET: " + route)
3133
}
34+
35+
// POST
36+
func (ro Router) Post(route string, cb func(w http.ResponseWriter, r *http.Request)){
37+
ro.routes[route] = cb
38+
fmt.Println("POST: " + route)
39+
}
40+
41+
// PATCH
42+
func (ro Router) Patch(route string, cb func(w http.ResponseWriter, r *http.Request)){
43+
ro.routes[route] = cb
44+
fmt.Println("PATCH: " + route)
45+
46+
}
47+
48+
// PUT
49+
func (ro Router) Put(route string, cb func(w http.ResponseWriter, r *http.Request)){
50+
ro.routes[route] = cb
51+
fmt.Println("PUT: " + route)
52+
}
53+
54+
// DELETE
55+
func (ro Router) Delete(route string, cb func(w http.ResponseWriter, r *http.Request)){
56+
ro.routes[route] = cb
57+
fmt.Println("DELETE: " + route)
58+
}

0 commit comments

Comments
 (0)