Skip to content

Do we need Static / StaticFS / StaticFile / StaticFileFS on the router? #18

Description

@qm012

Motivation

sim is a thin wrapper over net/http.ServeMux, so static file serving
already works today via raw stdlib composition:

app := sim.NewApp()                                                                                                                                                  
app.Handle("GET /static/", http.StripPrefix("/static/", http.FileServer(http.Dir("public"))))                                                                        

Do we want dedicated helpers at all — and if so, how many? Every method added to the API surface is a contract we maintain: docs, tests, and
naming decisions all follow.

How other frameworks do it (verified from source)

Framework Methods Directory listing default index.html
gin Static / StaticFS / StaticFile / StaticFileFS disabled (Dir(root,false)/OnlyFilesFS) yes
echo Static / StaticFS / File / FileFS none (never enumerates) yes
fiber Static (1, config-driven) disabled (Browse:false, opt-in) yes (Index:"index.html")
chi / mux stdlib default (enabled) yes

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions