From c6d2e9dadcd08cdf82aab507d9d4d8d58574df20 Mon Sep 17 00:00:00 2001 From: xengineering Date: Wed, 27 Dec 2023 13:33:59 +0100 Subject: Implement index page with recipe overview --- main.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'main.go') diff --git a/main.go b/main.go index 44e4172..0d84eef 100644 --- a/main.go +++ b/main.go @@ -10,6 +10,7 @@ import ( "syscall" "xengineering.eu/ceres/model" + "xengineering.eu/ceres/view" "github.com/gorilla/mux" ) @@ -21,6 +22,8 @@ func main() { model.InitDatabase() defer model.CloseDatabase() + view.Init() + var srv *http.Server = startServer("127.0.0.1:8080") go srv.ListenAndServe() defer stopServer(srv) @@ -41,6 +44,8 @@ func startServer(addr string) *http.Server { r.PathPrefix("/static/"). Handler(http.StripPrefix("/static/", http.FileServer(http.FS(static)))) + r.HandleFunc("/", view.HandlerHTML(&model.Index{})).Methods(`GET`) + muxer := http.NewServeMux() muxer.Handle("/", r) -- cgit v1.2.3-70-g09d2