summaryrefslogtreecommitdiff
path: root/view/recipes.go
blob: bd4c72b75e8b12e1ac9b3f0da3b0f04f1a1dc46c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package view

import (
	"net/http"

	"xengineering.eu/ceres/model"
)

func RecipesRead(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
	}
}