Handle registers a new request handle and middleware with the given path and method. The last handler should be the real handler, the other ones should be middleware that can and should be shared among different routes. See the example code in GitHub. For GET, POST, PUT, PATCH and DELETE requests t
(httpMethod, relativePath string, handlers ...HandlerFunc)
| 101 | // frequently used, non-standardized or custom methods (e.g. for internal |
| 102 | // communication with a proxy). |
| 103 | func (group *RouterGroup) Handle(httpMethod, relativePath string, handlers ...HandlerFunc) IRoutes { |
| 104 | if matched := regEnLetter.MatchString(httpMethod); !matched { |
| 105 | panic("http method " + httpMethod + " is not valid") |
| 106 | } |
| 107 | return group.handle(httpMethod, relativePath, handlers) |
| 108 | } |
| 109 | |
| 110 | // POST is a shortcut for router.Handle("POST", path, handlers). |
| 111 | func (group *RouterGroup) POST(relativePath string, handlers ...HandlerFunc) IRoutes { |