#109 basic infrastructure for server side rendering with templ

This commit is contained in:
Tim
2024-08-22 22:53:28 +02:00
parent 32c4da0f93
commit 62dd3b539f
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)
}