cerrado @ d0e0c1eb99303e1000140d4b98c610077278dc42

 1package static
 2
 3import (
 4	"io/fs"
 5	"net/http"
 6
 7	"git.gabrielgio.me/cerrado/static"
 8)
 9
10func ServeStaticHandler() (func(w http.ResponseWriter, r *http.Request), error) {
11	staticFs, err := fs.Sub(static.Static, ".")
12	if err != nil {
13		return nil, err
14	}
15
16	return func(w http.ResponseWriter, r *http.Request) {
17		f := r.PathValue("file")
18
19		http.ServeFileFS(w, r, staticFs, f)
20	}, nil
21}