From 7cecddd5ecd95c8d559208f9292a3590f8c4cb37 Mon Sep 17 00:00:00 2001 From: xengineering Date: Sun, 3 Mar 2024 14:09:56 +0100 Subject: controller: Provide recipe deletion via HTTP --- main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'main.go') diff --git a/main.go b/main.go index bcc5aa7..aa04065 100644 --- a/main.go +++ b/main.go @@ -44,10 +44,15 @@ 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`) + r.HandleFunc("/recipe/{id:[0-9]+}", view.Recipe).Methods(`GET`) - r.HandleFunc("/recipe", controller.Recipe).Methods(`POST`) + r.HandleFunc("/recipe", controller.RecipeUpdate).Methods(`POST`) + r.HandleFunc("/recipe/{id:[0-9]+}", controller.RecipeDelete).Methods(`DELETE`) + r.HandleFunc("/favicon.ico", view.Favicon).Methods(`GET`) + r.HandleFunc("/", view.Index).Methods(`GET`) muxer := http.NewServeMux() -- cgit v1.2.3-70-g09d2