#109 basic infrastructure for server side rendering with templ
This commit is contained in:
19
service/static_ui.go
Normal file
19
service/static_ui.go
Normal 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)
|
||||
}
|
||||
Reference in New Issue
Block a user