From 6d8ec55ac4deb9ba6e969b11ce75e7441fae3ee7 Mon Sep 17 00:00:00 2001 From: Abdulsamad Sheikh <abdulsas@stud.ntnu.no> Date: Wed, 21 Feb 2024 19:41:19 +0000 Subject: [PATCH] Upload New File --- main.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 main.go diff --git a/main.go b/main.go new file mode 100644 index 0000000..8704871 --- /dev/null +++ b/main.go @@ -0,0 +1,25 @@ +package main + + +import ( + "net/http" + "assignment1/handlers" + "time" +) + +func main() { + mux := http.NewServeMux() + + mux.HandleFunc("/librarystats/v1/bookcount/", handlers.BookCountHandler) + mux.HandleFunc("/librarystats/v1/readership/", handlers.ReadershipHandler) + mux.HandleFunc("/librarystats/v1/status/", handlers.StatusHandler) + + srv := &http.Server{ + Handler: mux, + Addr: "127.0.0.1:8080", + WriteTimeout: 15 * time.Second, + ReadTimeout: 15 * time.Second, + } + + http.ListenAndServe(":8080", mux) +} -- GitLab