summaryrefslogtreecommitdiff
path: root/server.go
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2023-09-17 11:07:08 +0200
committerxengineering <me@xengineering.eu>2023-09-17 11:07:08 +0200
commitea54de7d32e6b576ccfb430e7e57811b7c4587fe (patch)
tree4182e9c401e571adb53f1d6cbe2b072c171c87b2 /server.go
parentd0f58c4812c8b5821e9ed15806fae44f7b1fb095 (diff)
downloadceres-ea54de7d32e6b576ccfb430e7e57811b7c4587fe.tar
ceres-ea54de7d32e6b576ccfb430e7e57811b7c4587fe.tar.zst
ceres-ea54de7d32e6b576ccfb430e7e57811b7c4587fe.zip
Remove complete implementation
Restarting from scratch seems to be the fastest approach to switch to sqlite and get rid of some other structural mistakes from the past.
Diffstat (limited to 'server.go')
-rw-r--r--server.go44
1 files changed, 0 insertions, 44 deletions
diff --git a/server.go b/server.go
deleted file mode 100644
index 3c82f36..0000000
--- a/server.go
+++ /dev/null
@@ -1,44 +0,0 @@
-package main
-
-import (
- "log"
- "net/http"
- "strings"
-)
-
-func runServer() {
- address := config.Host + ":" + config.Port
- http.HandleFunc("/", route)
- log.Println("Serving content at 'http://" + address + "'.")
- log.Fatal(http.ListenAndServe(address, nil))
-}
-
-func route(w http.ResponseWriter, r *http.Request) {
-
- tab := routingTable{
- {"/favicon.ico", "GET", staticGet("favicon.ico")},
- {"/static/style.css", "GET", staticGet("style.css")},
- {"/add_recipes", "GET", addRecipesGet},
- {"/recipe/confirm-deletion", "GET", recipeConfirmDeletionGet},
- {"/recipe/confirm-deletion", "POST", recipeConfirmDeletionPost},
- {"/recipe/edit", "GET", recipeEditGet},
- {"/recipe/edit", "POST", recipeEditPost},
- {"/recipe", "GET", recipeGet},
- {"/", "GET", indexGet},
- }
-
- for _, v := range(tab) {
- if strings.HasPrefix(r.URL.String(), v.target) && r.Method == v.method {
- v.handler(w, r)
- return
- }
- }
-
- http.Error(w, "Bad Request", 400)
-}
-
-type routingTable []struct {
- target string
- method string
- handler func(w http.ResponseWriter, r *http.Request)
-}