about summary refs log tree commit diff
diff options
context:
space:
mode:
authorhanemile <hanemile@protonmail.com>2019-01-12 18:18:18 +0100
committerhanemile <hanemile@protonmail.com>2019-01-12 18:18:18 +0100
commit9b4a9947cece835f6d79010ee35d89cb59467906 (patch)
tree18cc1c641f0e9d1db16aa62275e1535d65b78b6a
parent306c2a9871a4f12519ef56f7ca9fa4a272381e32 (diff)
.
-rw-r--r--docker-compose.yml2
-rw-r--r--main.go16
2 files changed, 14 insertions, 4 deletions
diff --git a/docker-compose.yml b/docker-compose.yml
index f0c08d8..5b01520 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -4,4 +4,4 @@ services:
   simulate:
     build: .
     ports:
-      - "8345:8345"
\ No newline at end of file
+      - "80:80"
diff --git a/main.go b/main.go
index c33a669..c17902e 100644
--- a/main.go
+++ b/main.go
@@ -36,9 +36,16 @@ func calcNewPos(w http.ResponseWriter, r *http.Request) {
 	// get the post parameters
 	x, _ := strconv.ParseFloat(r.PostFormValue("x"), 64)
 	y, _ := strconv.ParseFloat(r.PostFormValue("y"), 64)
-	z, _ := strconv.ParseFloat(r.PostFormValue("z"), 64)
+	vx, _ := strconv.ParseFloat(r.PostFormValue("vx"), 64)
+	vy, _ := strconv.ParseFloat(r.PostFormValue("vy"), 64)
+	m, _ := strconv.ParseFloat(r.PostFormValue("m"), 64)
 
-	log.Printf("(%f, %f, %f)", x, y, z)
+	log.Println("Simulator container calcNewPos git these values: ")
+	log.Printf("(x: %f, y: %f, vx: %f, vy: %f, m: %f)\n", x, y, vx, vy, m)
+}
+
+func indexHandler(w http.ResponseWriter, r *http.Request) {
+	_, _ = fmt.Fprintf(w, "Hello, this is the simu container!")
 }
 
 func main() {
@@ -49,5 +56,8 @@ func main() {
 	// this is an endpoint searching for a star and calculating the forces acting inbetween it and all the other star
 	// in it's direct range
 	router.HandleFunc("/newpos", calcNewPos).Methods("POST")
-	log.Fatal(http.ListenAndServe(":8345", router))
+
+	router.HandleFunc("/", indexHandler).Methods("GET")
+
+	log.Fatal(http.ListenAndServe(":8002", router))
 }