File registers a new route with path to serve a static file with optional route-level middleware. Panics on error. Avoid using the leading `/` slash as most of the Go standard library fs.FS implementations require relative paths for file operations.
(path, file string, middleware ...MiddlewareFunc)
| 678 | // Avoid using the leading `/` slash as most of the Go standard library fs.FS implementations require relative paths for |
| 679 | // file operations. |
| 680 | func (e *Echo) File(path, file string, middleware ...MiddlewareFunc) RouteInfo { |
| 681 | handler := func(c *Context) error { |
| 682 | return c.File(file) |
| 683 | } |
| 684 | return e.Add(http.MethodGet, path, handler, middleware...) |
| 685 | } |
| 686 | |
| 687 | // AddRoute registers a new Route with default host Router |
| 688 | func (e *Echo) AddRoute(route Route) (RouteInfo, error) { |