Skip to content

Add StaticFS method #2059

@flimzy

Description

@flimzy

Issue Description

Checklist

  • Dependencies installed
  • No typos
  • Searched existing issues and docs

Expected behaviour

As of Echo 4.6.1, we have the (*Echo).Static(prefix, root string) *Route method. With the advent of Go 1.16, we have the new fs.FS type which expands upon the older concept of http.Dir as used by http.FileServer, to allow serving of files from any FS-like location, not just on disk.

I think it would be logical for Echo to support this new standard as well. The simplest approach I think would be to add a StaticFS method, probably with the following signature:

func (e *Echo) StaticFS(prefix string, root fs.FS) *Route

Version/commit

v4.6.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions