1package handler
2
3import (
4 "io/fs"
5 "net/http"
6
7 "git.gabrielgio.me/cerrado/static"
8)
9
10func NewStaticHander(prefix string) (http.Handler, error) {
11 staticFs, err := fs.Sub(static.Static, ".")
12 if err != nil {
13 return nil, err
14 }
15
16 handler := http.StripPrefix(prefix, http.FileServer(http.FS(staticFs)))
17 return handler, nil
18}