From 4f47b86c0728a05f79b29d57720a135e5b18efef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Steffen=20S=C3=A6ther?= <steffels@stud.ntnu.no>
Date: Wed, 6 Mar 2024 19:42:33 +0000
Subject: [PATCH] Delete main.go

---
 main.go | 34 ----------------------------------
 1 file changed, 34 deletions(-)
 delete mode 100644 main.go

diff --git a/main.go b/main.go
deleted file mode 100644
index e382d2f..0000000
--- a/main.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"main/endpoints"
-	"net/http"
-)
-
-// EndpointHandler defines the structure of handlers.
-type EndpointHandler func(http.ResponseWriter, *http.Request)
-
-func main() {
-	http.HandleFunc("/librarystats/v1/bookcount/", makeHandler(endpoints.BookCountHandler))
-	http.HandleFunc("/librarystats/v1/readership/", makeHandler(endpoints.ReadershipHandler))
-	http.HandleFunc("/librarystats/v1/status/", makeHandler(endpoints.StatusHandler))
-	http.HandleFunc("/", makeHandler(endpoints.Errorhandler))
-
-	fmt.Println("Server is running on :8080...")
-	http.ListenAndServe(":8080", nil)
-}
-
-// makeHandler is a wrapper to handle panics and set common headers.
-func makeHandler(handler EndpointHandler) http.HandlerFunc {
-	return func(w http.ResponseWriter, r *http.Request) {
-		defer func() {
-			if err := recover(); err != nil {
-				http.Error(w, "Internal Server Error", http.StatusInternalServerError)
-			}
-		}()
-
-		w.Header().Set("Content-Type", "application/json")
-		handler(w, r)
-	}
-}
-- 
GitLab