MCPcopy Index your code
hub / github.com/labstack/echo / File

Method File

echo.go:680–685  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

678// Avoid using the leading `/` slash as most of the Go standard library fs.FS implementations require relative paths for
679// file operations.
680func (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
688func (e *Echo) AddRoute(route Route) (RouteInfo, error) {

Callers 3

TestContext_FileFunction · 0.45
TestGroupFileFunction · 0.45
TestEchoFileFunction · 0.45

Calls 1

AddMethod · 0.95

Tested by 3

TestContext_FileFunction · 0.36
TestGroupFileFunction · 0.36
TestEchoFileFunction · 0.36