Match implements `Echo#Match()` for sub-routes within the Group. Panics on error.
(methods []string, path string, handler HandlerFunc, middleware ...MiddlewareFunc)
| 75 | |
| 76 | // Match implements `Echo#Match()` for sub-routes within the Group. Panics on error. |
| 77 | func (g *Group) Match(methods []string, path string, handler HandlerFunc, middleware ...MiddlewareFunc) Routes { |
| 78 | errs := make([]error, 0) |
| 79 | ris := make(Routes, 0) |
| 80 | for _, m := range methods { |
| 81 | ri, err := g.AddRoute(Route{ |
| 82 | Method: m, |
| 83 | Path: path, |
| 84 | Handler: handler, |
| 85 | Middlewares: middleware, |
| 86 | }) |
| 87 | if err != nil { |
| 88 | errs = append(errs, err) |
| 89 | continue |
| 90 | } |
| 91 | ris = append(ris, ri) |
| 92 | } |
| 93 | if len(errs) > 0 { |
| 94 | panic(errs) // this is how `v4` handles errors. `v5` has methods to have panic-free usage |
| 95 | } |
| 96 | return ris |
| 97 | } |
| 98 | |
| 99 | // Group creates a new sub-group with prefix and optional sub-group-level middleware. |
| 100 | // Important! Group middlewares are only executed in case there was exact route match and not |