Almost there

This commit is contained in:
Daniel Ledda
2020-11-14 15:10:55 +01:00
parent d6b60b2c03
commit 6c3559a89c

View File

@@ -18,9 +18,9 @@ const ROOT_URL = "/climate"
func startServer() { func startServer() {
port := "8001" port := "8001"
router := mux.NewRouter() router := mux.NewRouter()
router.HandleFunc("/", showCharts).Methods("GET") router.HandleFunc("", showCharts).Methods("GET")
router.HandleFunc("/", showCharts).Methods("GET").Queries("show-minutes", "{[0-9]+}") router.HandleFunc("", showCharts).Methods("GET").Queries("show-minutes", "{[0-9]+}")
router.HandleFunc("/", saveSnapshot).Methods("POST") router.HandleFunc("", saveSnapshot).Methods("POST")
router.HandleFunc("/data", sendData).Methods("GET") router.HandleFunc("/data", sendData).Methods("GET")
router.HandleFunc("/data", sendData).Methods("GET").Queries("since", "") router.HandleFunc("/data", sendData).Methods("GET").Queries("since", "")
router.HandleFunc("/data/now", createAndSendSnapshot).Methods("GET") router.HandleFunc("/data/now", createAndSendSnapshot).Methods("GET")