Add implements `Echo#Add()` for sub-routes within the Group. Panics on error.
(method, path string, handler HandlerFunc, middleware ...MiddlewareFunc)
| 156 | |
| 157 | // Add implements `Echo#Add()` for sub-routes within the Group. Panics on error. |
| 158 | func (g *Group) Add(method, path string, handler HandlerFunc, middleware ...MiddlewareFunc) RouteInfo { |
| 159 | ri, err := g.AddRoute(Route{ |
| 160 | Method: method, |
| 161 | Path: path, |
| 162 | Handler: handler, |
| 163 | Middlewares: middleware, |
| 164 | }) |
| 165 | if err != nil { |
| 166 | panic(err) // this is how `v4` handles errors. `v5` has methods to have panic-free usage |
| 167 | } |
| 168 | return ri |
| 169 | } |
| 170 | |
| 171 | // AddRoute registers a new Routable with Router |
| 172 | func (g *Group) AddRoute(route Route) (RouteInfo, error) { |