about summary refs log tree commit diff
diff options
context:
space:
mode:
authorhanemile <hanemile@protonmail.com>2019-01-24 20:36:42 +0100
committerhanemile <hanemile@protonmail.com>2019-01-24 20:36:42 +0100
commite7951d4b5cf882169b2e849c2d28187cf643c1c1 (patch)
tree92e1e25a123f354d86687071764acaf38a9283e8
parent48451fa85af62d28bfb9257ae8c2b05cecea80fe (diff)
update
-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))