blob: 81ed6bec267f848dfc5cc476ef41e57a4dd1ee29 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package web
import (
"embed"
"io/fs"
"net/http"
)
//go:generate npm ci
//go:generate npm run generate
//go:embed all:.output/public
var fsys embed.FS
type WebFileServer struct {
server http.Handler
}
func NewWebFileServer() *WebFileServer {
fsys, _ := fs.Sub(fsys, ".output/public")
return &WebFileServer{
server: http.FileServerFS(fsys),
}
}
func (fs *WebFileServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
fs.server.ServeHTTP(w, r)
}
|