#109 basic infrastructure for server side rendering with templ
Some checks failed
Build Docker Image / Explore-Gitea-Actions (push) Failing after 5s

This commit is contained in:
Tim
2024-08-22 22:53:28 +02:00
parent de8a5051e7
commit 4718622ce0
12 changed files with 82 additions and 31 deletions

19
service/static_ui.go Normal file
View File

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