diff options
Diffstat (limited to 'mux.go')
-rw-r--r-- | mux.go | 110 |
1 files changed, 48 insertions, 62 deletions
@@ -5,85 +5,71 @@ import ( "net/http" ) -func indexMux() func(http.ResponseWriter, *http.Request) { - return func(w http.ResponseWriter, r *http.Request) { - switch r.Method { - case "GET": - indexGet(w, r) - default: - http.Error(w, "Bad Request", 400) - } +func indexMux(w http.ResponseWriter, r *http.Request) { + switch r.Method { + case "GET": + indexGet(w, r) + default: + http.Error(w, "Bad Request", 400) } } -func recipeMux() func(http.ResponseWriter, *http.Request) { - return func(w http.ResponseWriter, r *http.Request) { - switch r.Method { - case "GET": - recipeGet(w, r) - case "POST": - recipePost(w, r) - default: - http.Error(w, "Bad Request", 400) - } +func recipeMux(w http.ResponseWriter, r *http.Request) { + switch r.Method { + case "GET": + recipeGet(w, r) + case "POST": + recipePost(w, r) + default: + http.Error(w, "Bad Request", 400) } } -func recipeEditMux() func(http.ResponseWriter, *http.Request) { - return func(w http.ResponseWriter, r *http.Request) { - switch r.Method { - case "GET": - recipeEditGet(w, r) - case "POST": - recipeEditPost(w, r) - default: - http.Error(w, "Bad Request", 400) - } +func recipeEditMux(w http.ResponseWriter, r *http.Request) { + switch r.Method { + case "GET": + recipeEditGet(w, r) + case "POST": + recipeEditPost(w, r) + default: + http.Error(w, "Bad Request", 400) } } -func recipeImageMux() func(http.ResponseWriter, *http.Request) { - return func(w http.ResponseWriter, r *http.Request) { - switch r.Method { - case "GET": - recipeImageGet(w, r) - default: - http.Error(w, "Bad Request", 400) - } +func recipeImageMux(w http.ResponseWriter, r *http.Request) { + switch r.Method { + case "GET": + recipeImageGet(w, r) + default: + http.Error(w, "Bad Request", 400) } } -func addRecipesMux() func(http.ResponseWriter, *http.Request) { - return func(w http.ResponseWriter, r *http.Request) { - switch r.Method { - case "GET": - addRecipesGet(w, r) - case "POST": - addRecipesPost(w, r) - default: - http.Error(w, "Bad Request", 400) - } +func addRecipesMux(w http.ResponseWriter, r *http.Request) { + switch r.Method { + case "GET": + addRecipesGet(w, r) + case "POST": + addRecipesPost(w, r) + default: + http.Error(w, "Bad Request", 400) } } -func staticStyleMux() func(http.ResponseWriter, *http.Request) { - return func(w http.ResponseWriter, r *http.Request) { - switch r.Method { - case "GET": - staticGet(w, r, "style.css") - default: - http.Error(w, "Bad Request", 400) - } +func staticStyleMux(w http.ResponseWriter, r *http.Request) { + switch r.Method { + case "GET": + staticGet(w, r, "style.css") + default: + http.Error(w, "Bad Request", 400) } } -func faviconMux() func(http.ResponseWriter, *http.Request) { - return func(w http.ResponseWriter, r *http.Request) { - switch r.Method { - case "GET": - staticGet(w, r, "favicon.ico") - default: - http.Error(w, "Bad Request", 400) - } +func faviconMux(w http.ResponseWriter, r *http.Request) { + switch r.Method { + case "GET": + staticGet(w, r, "favicon.ico") + default: + http.Error(w, "Bad Request", 400) } } |