From 6a4f1aee179a25b62b02deffd0ad97914cbcca87 Mon Sep 17 00:00:00 2001 From: xengineering Date: Sun, 3 Mar 2024 16:56:42 +0100 Subject: Add ID to URL in recipe updates This makes the update URL more consistent with the other ones. A check ensures consistency of the URL and JSON ID values. --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'main.go') diff --git a/main.go b/main.go index ec061c2..1660088 100644 --- a/main.go +++ b/main.go @@ -48,7 +48,7 @@ func startServer(addr string) *http.Server { r.HandleFunc("/recipes", view.RecipesRead).Methods(`GET`) r.HandleFunc("/recipe/{id:[0-9]+}", view.RecipeRead).Methods(`GET`) - r.HandleFunc("/recipe", controller.RecipeUpdate).Methods(`POST`) + r.HandleFunc("/recipe/{id:[0-9]+}", controller.RecipeUpdate).Methods(`POST`) r.HandleFunc("/recipe/{id:[0-9]+}", controller.RecipeDelete).Methods(`DELETE`) r.HandleFunc("/favicon.ico", view.FaviconRead).Methods(`GET`) -- cgit v1.2.3-70-g09d2