Static registers a new route with path prefix to serve static files from the provided root directory.
(pathPrefix, fsRoot string, middleware ...MiddlewareFunc)
| 590 | |
| 591 | // Static registers a new route with path prefix to serve static files from the provided root directory. |
| 592 | func (e *Echo) Static(pathPrefix, fsRoot string, middleware ...MiddlewareFunc) RouteInfo { |
| 593 | subFs := MustSubFS(e.Filesystem, fsRoot) |
| 594 | return e.Add( |
| 595 | http.MethodGet, |
| 596 | pathPrefix+"*", |
| 597 | StaticDirectoryHandler(subFs, !e.enablePathUnescapingStaticFiles), |
| 598 | middleware..., |
| 599 | ) |
| 600 | } |
| 601 | |
| 602 | // StaticFS registers a new route with path prefix to serve static files from the provided file system. |
| 603 | // |