Add auth, rest api, svelte frontend, build structure

This commit is contained in:
2025-06-02 08:44:10 +02:00
parent 97be451306
commit 17ab7c4929
222 changed files with 3057 additions and 136 deletions

View File

@@ -2,7 +2,27 @@ package web
import (
"embed"
"net/http"
"text/template"
"github.com/olivere/vite"
)
type PageData struct {
Title string
MsgType string
Message string
Redirect string
Vite *vite.Fragment
}
//go:embed templates
var Templates embed.FS
//go:embed frontend/dist
var StaticAssets embed.FS
func RenderTemplate(w http.ResponseWriter, name string, data PageData) error {
tpl := template.Must(template.ParseFS(Templates, "templates/"+name+".html", "templates/base.html"))
return tpl.ExecuteTemplate(w, "base", data)
}