blob: e7153cd0e09699da83004ea41643e68bda7b1960 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package view
import (
"net/http"
"xengineering.eu/ceres/model"
)
func RecipesRead(db *model.DB) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
recipes := make(model.Recipes, 0)
var obj model.Object = &recipes
err := db.Transaction(obj.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
}
}
}
|