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