From 9a50eda5da952dd296ecc89d774d0a0e9ccd449d Mon Sep 17 00:00:00 2001 From: ErikLavr <106452123+ErikLavr@users.noreply.github.com> Date: Sat, 1 Feb 2025 20:05:02 +0100 Subject: [PATCH 1/2] Update main.go --- main.go | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 88c6019..af7abe6 100644 --- a/main.go +++ b/main.go @@ -9,7 +9,12 @@ import ( func main() { r := mux.NewRouter() - r.HandleFunc("/", HomeHandler) + r.HandleFunc("/", HomeHandler) // POST + r.HandleFunc("/api/sites/create", SiteCreationHandler) // POST + r.HandleFunc("/api/sites/delete", SiteDeletionHandler) // POST + r.HandleFunc("/api/sites/update", SiteListHandler) // POST + r.HandleFunc("/api/sites/list", SiteCreationHandler) // POST + r.HandleFunc("/api/sites/login", SiteLoginHandler) // POST r.Use(Middleware) http.ListenAndServe(":8080", r) @@ -22,6 +27,21 @@ func Middleware(next http.Handler) http.Handler { }) } +func SiteCreationHandler(w http.ResponseWriter, r *http.Request) { + w.Write([]byte("Hello, World!")) +} +func SiteDeletionHandler(w http.ResponseWriter, r *http.Request) { + w.Write([]byte("Hello, World!")) +} +func SiteUpdateHandler(w http.ResponseWriter, r *http.Request) { + w.Write([]byte("Hello, World!")) +} +func SiteListHandler(w http.ResponseWriter, r *http.Request) { + w.Write([]byte("Hello, World!")) +} +func SiteLoginHandler(w http.ResponseWriter, r *http.Request) { + w.Write([]byte("Hello, World!")) +} func HomeHandler(w http.ResponseWriter, r *http.Request) { w.Write([]byte("Hello, World!")) } From 1020f22efd2e582098ac2ba2c26436523205d051 Mon Sep 17 00:00:00 2001 From: ErikLavr <106452123+ErikLavr@users.noreply.github.com> Date: Sat, 1 Feb 2025 20:57:56 +0100 Subject: [PATCH 2/2] Update main.go --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index af7abe6..494c3f9 100644 --- a/main.go +++ b/main.go @@ -12,8 +12,8 @@ func main() { r.HandleFunc("/", HomeHandler) // POST r.HandleFunc("/api/sites/create", SiteCreationHandler) // POST r.HandleFunc("/api/sites/delete", SiteDeletionHandler) // POST - r.HandleFunc("/api/sites/update", SiteListHandler) // POST - r.HandleFunc("/api/sites/list", SiteCreationHandler) // POST + r.HandleFunc("/api/sites/update", SiteUpdateHandler) // POST + r.HandleFunc("/api/sites/list", SiteListHandler) // POST r.HandleFunc("/api/sites/login", SiteLoginHandler) // POST r.Use(Middleware)