summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2020-07-10 22:17:11 +0200
committerAki <please@ignore.pl>2020-07-10 22:17:11 +0200
commitb245f4555ef4a4543c40a4d790cba6cb640823d1 (patch)
tree3a10422ecdadbe2ba6037ff43acc79cfe627d20e
parent9c4f3043d13f09e5dd9f5c5c6e51dc185dce91fd (diff)
downloadstats-b245f4555ef4a4543c40a4d790cba6cb640823d1.zip
stats-b245f4555ef4a4543c40a4d790cba6cb640823d1.tar.gz
stats-b245f4555ef4a4543c40a4d790cba6cb640823d1.tar.bz2
Added home handler again
-rw-r--r--main.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/main.go b/main.go
index c521203..c498a5f 100644
--- a/main.go
+++ b/main.go
@@ -7,6 +7,10 @@ import (
"net/http"
)
+func handleHome(w http.ResponseWriter, r *http.Request) {
+ w.Write([]byte("stats OK"))
+}
+
func handleEntryOptions(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Methods", "POST")
@@ -36,6 +40,7 @@ func handleEntryPost(w http.ResponseWriter, r *http.Request) {
func handleRequests() {
router := mux.NewRouter()
+ router.HandleFunc("/", handleHome)
router.HandleFunc("/entry", handleEntryPost).Methods("POST")
router.HandleFunc("/entry", handleEntryOptions).Methods("OPTIONS")