Files
tueem d1d49ecc49
build / Go-Build (push) Failing after 15s
feat(frontend): add files
2026-06-24 11:58:59 +02:00

25 lines
452 B
Go

package assets
import (
"embed"
"io/fs"
"net/http"
)
//go:embed frontend/dist/*
var frontendFS embed.FS
func HttpServer() http.Handler {
fs, err := fs.Sub(frontendFS, "frontend/dist")
if err != nil {
panic(err)
}
return http.FileServerFS(fs)
}
func ServeIndex(w http.ResponseWriter, r *http.Request) {
file, _ := frontendFS.ReadFile("frontend/dist/index.html")
w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.Write(file)
}