diff --git a/handlers/page.go b/handlers/page.go new file mode 100644 index 0000000..54f8041 --- /dev/null +++ b/handlers/page.go @@ -0,0 +1,14 @@ +package handlers + +import ( + "github.com/a-h/templ" + "net/http" +) + +func HandlePage(Page templ.Component) http.Handler { + return http.HandlerFunc( + func(w http.ResponseWriter, r *http.Request) { + Page.Render(r.Context(), w) + }, + ) +} diff --git a/server/routes.go b/server/routes.go index d5a3367..f1433e5 100644 --- a/server/routes.go +++ b/server/routes.go @@ -3,6 +3,7 @@ package server import ( "net/http" "projectreshoot/handlers" + "projectreshoot/view/page" ) func addRoutes( @@ -10,4 +11,6 @@ func addRoutes( ) { mux.Handle("GET /static/", http.StripPrefix("/static/", handlers.HandleStatic())) mux.Handle("GET /", handlers.HandleRoot()) + mux.Handle("GET /about", handlers.HandlePage(page.About())) + mux.Handle("GET /login", handlers.HandlePage(page.Login())) } diff --git a/view/component/footer/footer.templ b/view/component/footer/footer.templ index 8ca10b3..ff3c131 100644 --- a/view/component/footer/footer.templ +++ b/view/component/footer/footer.templ @@ -19,7 +19,7 @@ func getFooterItems() []FooterItem { } templ Footer() { -