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

Method StaticFS

group.go:122–129  ·  view source on GitHub ↗

StaticFS implements `Echo#StaticFS()` for sub-routes within the Group. When dealing with `embed.FS` use `fs := echo.MustSubFS(fs, "rootDirectory") to create sub fs which uses necessary prefix for directory path. This is necessary as `//go:embed assets/images` embeds files with paths including `asse

(pathPrefix string, filesystem fs.FS, middleware ...MiddlewareFunc)

Source from the content-addressed store, hash-verified

120// prefix for directory path. This is necessary as `//go:embed assets/images` embeds files with paths
121// including `assets/images` as their prefix.
122func (g *Group) StaticFS(pathPrefix string, filesystem fs.FS, middleware ...MiddlewareFunc) RouteInfo {
123 return g.Add(
124 http.MethodGet,
125 pathPrefix+"*",
126 StaticDirectoryHandler(filesystem, !g.echo.enablePathUnescapingStaticFiles),
127 middleware...,
128 )
129}
130
131// FileFS implements `Echo#FileFS()` for sub-routes within the Group.
132//

Callers 1

StaticMethod · 0.95

Calls 2

AddMethod · 0.95
StaticDirectoryHandlerFunction · 0.85

Tested by

no test coverage detected