summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2024-02-11 22:44:32 +0100
committerxengineering <me@xengineering.eu>2024-02-13 20:26:42 +0100
commit40868be7d4b9e1d9909a19dccc25ec49c1b5924b (patch)
tree97a8923b73c97a4ce92f15ad632cfb65faf06d5c /main.go
parent43fdfde44bce659abd30186150f667d8ba24cf2b (diff)
downloadceres-40868be7d4b9e1d9909a19dccc25ec49c1b5924b.tar
ceres-40868be7d4b9e1d9909a19dccc25ec49c1b5924b.tar.zst
ceres-40868be7d4b9e1d9909a19dccc25ec49c1b5924b.zip
view: Implement GET handler for model.Recipes
Diffstat (limited to 'main.go')
-rw-r--r--main.go4
1 files changed, 4 insertions, 0 deletions
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)