diff --git a/controller.go b/controller.go index 651eb0d..4c9b38d 100644 --- a/controller.go +++ b/controller.go @@ -18,7 +18,7 @@ func (c *controller) LoadRouter(pub fs.FS) { serveMux.HandleFunc("POST /order/new", c.postNewOrder) serveMux.HandleFunc("GET /available_cakes", c.cakeOptions) serveMux.HandleFunc("GET /edit_cakes", c.cakeOptions) - serveMux.HandleFunc("GET /cake_editor", c.editCakes) + serveMux.HandleFunc("GET /cake_editor", c.cakeEditor) serveMux.HandleFunc("POST /new_cake", c.newCake) c.Handler = serveMux diff --git a/handlers.go b/handlers.go index 6040973..452be2d 100644 --- a/handlers.go +++ b/handlers.go @@ -17,12 +17,13 @@ func (c *controller) cakeOptions(w http.ResponseWriter, r *http.Request) { c.tmpl[template].Execute(w, struct{ Cakes []cake }{Cakes: []cake{{"Hello", 1}, {"World", 2}}}) } -func (c *controller) editCakes(w http.ResponseWriter, r *http.Request) { +func (c *controller) cakeEditor(w http.ResponseWriter, r *http.Request) { type cake struct { Name string ID int Price int } + w.Header().Set("Content-Type", "text/html") c.tmpl["cake_editor"].Execute(w, cake{"Hello", 1, 120}) } diff --git a/templates/cake_editor.html b/templates/cake_editor.html index f3070dc..5aaf568 100644 --- a/templates/cake_editor.html +++ b/templates/cake_editor.html @@ -1,5 +1,4 @@
-
diff --git a/templates/edit_cakes.html b/templates/edit_cakes.html index 668c5b0..296540d 100644 --- a/templates/edit_cakes.html +++ b/templates/edit_cakes.html @@ -4,7 +4,7 @@
{{range .Cakes}} - + {{end}}