From 40868be7d4b9e1d9909a19dccc25ec49c1b5924b Mon Sep 17 00:00:00 2001 From: xengineering Date: Sun, 11 Feb 2024 22:44:32 +0100 Subject: view: Implement GET handler for model.Recipes --- main.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'main.go') diff --git a/main.go b/main.go index 44e4172..cbf1593 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) @@ -40,6 +43,7 @@ func startServer(addr string) *http.Server { r.PathPrefix("/static/"). Handler(http.StripPrefix("/static/", http.FileServer(http.FS(static)))) + r.HandleFunc("/recipes", view.Recipes).Methods(`GET`) muxer := http.NewServeMux() muxer.Handle("/", r) -- cgit v1.2.3-70-g09d2