summaryrefslogtreecommitdiff
path: root/mux.go
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2023-02-11 13:46:45 +0100
committerxengineering <me@xengineering.eu>2023-02-11 13:46:45 +0100
commit6b52b4bbc81c64b29daff043b83e21c38f332052 (patch)
tree3a5d41f75228fe6ece3df5c109365d54b0ba6d04 /mux.go
parent312c59564700da719dbafad11c2d9f647b46d912 (diff)
downloadceres-6b52b4bbc81c64b29daff043b83e21c38f332052.tar
ceres-6b52b4bbc81c64b29daff043b83e21c38f332052.tar.zst
ceres-6b52b4bbc81c64b29daff043b83e21c38f332052.zip
Switch to global database pointer
Passing the database pointer around is a lot of text and has no benefit.
Diffstat (limited to 'mux.go')
-rw-r--r--mux.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/mux.go b/mux.go
index 3aed42d..2b37286 100644
--- a/mux.go
+++ b/mux.go
@@ -5,37 +5,37 @@ import (
"net/http"
)
-func indexMux(db *Database) func(http.ResponseWriter, *http.Request) {
+func indexMux() func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
switch r.Method {
case "GET":
- indexGet(w, r, db)
+ indexGet(w, r)
default:
http.Error(w, "Bad Request", 400)
}
}
}
-func recipeMux(db *Database) func(http.ResponseWriter, *http.Request) {
+func recipeMux() func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
switch r.Method {
case "GET":
- recipeGet(w, r, db)
+ recipeGet(w, r)
case "POST":
- recipePost(w, r, db)
+ recipePost(w, r)
default:
http.Error(w, "Bad Request", 400)
}
}
}
-func recipeEditMux(db *Database) func(http.ResponseWriter, *http.Request) {
+func recipeEditMux() func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
switch r.Method {
case "GET":
- recipeEditGet(w, r, db)
+ recipeEditGet(w, r)
case "POST":
- recipeEditPost(w, r, db)
+ recipeEditPost(w, r)
default:
http.Error(w, "Bad Request", 400)
}
@@ -53,13 +53,13 @@ func recipeImageMux() func(http.ResponseWriter, *http.Request) {
}
}
-func addRecipesMux(db *Database) func(http.ResponseWriter, *http.Request) {
+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, db)
+ addRecipesPost(w, r)
default:
http.Error(w, "Bad Request", 400)
}