20 lines
331 B
Go
20 lines
331 B
Go
package live
|
|
|
|
import (
|
|
"embed"
|
|
"io/fs"
|
|
"net/http"
|
|
)
|
|
|
|
//go:embed web/index.html
|
|
var webFS embed.FS
|
|
|
|
func staticHandler() http.Handler {
|
|
sub, err := fs.Sub(webFS, "web")
|
|
if err != nil {
|
|
// Embed misconfiguration is a build-time bug; fall back to 404.
|
|
return http.NotFoundHandler()
|
|
}
|
|
return http.FileServer(http.FS(sub))
|
|
}
|