#109 switch svelte to SSR with go

This commit is contained in:
2024-08-21 23:33:06 +02:00
parent eac373739a
commit f3fb046749
53 changed files with 1796 additions and 6353 deletions

20
service/static_ui.go Normal file
View File

@@ -0,0 +1,20 @@
package service
import (
"me-fit/templates"
"net/http"
"github.com/a-h/templ"
)
func HandleIndexAnd404(w http.ResponseWriter, r *http.Request) {
var comp templ.Component = nil
if r.URL.Path != "/" {
comp = templates.Layout(templates.NotFound())
w.WriteHeader(http.StatusNotFound)
} else {
comp = templates.Layout(templates.Index())
}
comp.Render(r.Context(), w)
}