Compile prepares a middleware chain from the route list. This should only be done either once during provisioning for top-level routes, or on each request just before the middleware chain is executed for subroutes.
(next Handler)
| 237 | // for top-level routes, or on each request just before the |
| 238 | // middleware chain is executed for subroutes. |
| 239 | func (routes RouteList) Compile(next Handler) Handler { |
| 240 | mid := make([]Middleware, 0, len(routes)) |
| 241 | for _, route := range routes { |
| 242 | mid = append(mid, wrapRoute(route)) |
| 243 | } |
| 244 | stack := next |
| 245 | for _, middleware := range slices.Backward(mid) { |
| 246 | stack = middleware(stack) |
| 247 | } |
| 248 | return stack |
| 249 | } |
| 250 | |
| 251 | // wrapRoute wraps route with a middleware and handler so that it can |
| 252 | // be chained in and defer evaluation of its matchers to request-time. |
nothing calls this directly
no test coverage detected