From e7951d4b5cf882169b2e849c2d28187cf643c1c1 Mon Sep 17 00:00:00 2001 From: hanemile Date: Thu, 24 Jan 2019 20:36:42 +0100 Subject: update --- main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 572bcfd..2e527f6 100644 --- a/main.go +++ b/main.go @@ -61,6 +61,11 @@ func readdirHandler(w http.ResponseWriter, r *http.Request) { } } +// return the amount of galaxies currently present +func nrofgalaxiesHandler(w http.ResponseWriter, r *http.Request) { + _, _ = fmt.Fprintf(w, "%d", len(treeArray)) +} + func main() { router := mux.NewRouter() @@ -74,11 +79,12 @@ func main() { router.HandleFunc("/updatecenterofmass/{treeindex}", updateCenterOfMassHandler).Methods("GET") router.HandleFunc("/metrics", metricHandler).Methods("GET") router.HandleFunc("/export/{treeindex}", exportHandler).Methods("POST") + router.HandleFunc("/nrofgalaxies", nrofgalaxiesHandler).Methods("GET") router.HandleFunc("/fastinsertjson/{filename}", fastInsertJSONHandler).Methods("GET") router.HandleFunc("/fastinsertlist/{filename}/{treeindex}", fastInsertListHandler).Methods("GET") - router.HandleFunc("/readdir/{dirname}", readdirHandler).Methods("GET") + // router.HandleFunc("/readdir/{dirname}", readdirHandler).Methods("GET") fmt.Println("Database Container up") log.Fatal(http.ListenAndServe(":80", router)) -- cgit 1.4.1