about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--main.go8
1 files changed, 7 insertions, 1 deletions
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))