diff calsync/main.go @ 59:1f8e66cb0108

deployment
author drewp@bigasterisk.com
date Fri, 06 Sep 2024 16:37:04 -0700
parents 24f662799710
children 3b0595c2bf03
line wrap: on
line diff
--- a/calsync/main.go	Thu Sep 05 17:01:23 2024 -0700
+++ b/calsync/main.go	Fri Sep 06 16:37:04 2024 -0700
@@ -59,15 +59,17 @@
 	r := mux.NewRouter()
 	http.Handle("/", r)
 
-	home := func(w http.ResponseWriter, r *http.Request) {
-		w.Write([]byte("calsync service for calendar updates"))
-	}
-	r.HandleFunc("/", home)
-	r.HandleFunc("/gcalendarwatch", home)
+	r.HandleFunc("/", homePage)
+	r.HandleFunc("/gcalendarwatch", homePage)
+	r.HandleFunc("/gcalendarwatch/notifications", notifications.NotificationHandler).Methods("POST")
+	
+	addr:=":8080"
+	log.Println("serving /gcalendarwatch/notifications on", addr)
+	log.Fatal(http.ListenAndServe(addr, nil))
+}
 
-	notificationHandler := func(w http.ResponseWriter, r *http.Request) {
-	}
-	r.HandleFunc("/gcalendarwatch/notification", notificationHandler).Methods("POST")
-	log.Println(("serving /gcalendarwatch/notification on :8080"))
-	log.Fatal(http.ListenAndServe(":8080", nil))
 }
+
+func homePage(w http.ResponseWriter, r *http.Request) {
+						w.Write([]byte("calsync service for calendar updates. See https://console.cloud.google.com/apis/api/calendar-json.googleapis.com/metrics?project=bigasterisk-910"))
+					}