summaryrefslogtreecommitdiff
path: root/view/recipes.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 /view/recipes.go
parent43fdfde44bce659abd30186150f667d8ba24cf2b (diff)
downloadceres-40868be7d4b9e1d9909a19dccc25ec49c1b5924b.tar
ceres-40868be7d4b9e1d9909a19dccc25ec49c1b5924b.tar.zst
ceres-40868be7d4b9e1d9909a19dccc25ec49c1b5924b.zip
view: Implement GET handler for model.Recipes
Diffstat (limited to 'view/recipes.go')
-rw-r--r--view/recipes.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/view/recipes.go b/view/recipes.go
new file mode 100644
index 0000000..3a5fbf8
--- /dev/null
+++ b/view/recipes.go
@@ -0,0 +1,23 @@
+package view
+
+import (
+ "net/http"
+
+ "xengineering.eu/ceres/model"
+)
+
+func Recipes(w http.ResponseWriter, r *http.Request) {
+ recipes := make(model.Recipes, 0)
+
+ err := recipes.Read()
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+
+ err = html.ExecuteTemplate(w, "recipes", recipes)
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+}