diff options
author | Emile <hanemile@protonmail.com> | 2019-02-28 18:45:13 +0100 |
---|---|---|
committer | Emile <hanemile@protonmail.com> | 2019-02-28 18:45:13 +0100 |
commit | b36847c031db55fe7a2cdf40112ad01c424355bd (patch) | |
tree | 8ee7b64c88543192371f4a7171df229e0e15e09f | |
parent | d35b4450651f0d0b9cc5209325e6422b8d0d1ae3 (diff) |
:art: commented the generateHandler
-rw-r--r-- | main.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/main.go b/main.go index e9e6558..1020517 100644 --- a/main.go +++ b/main.go @@ -112,15 +112,21 @@ func gen(galaxyRange float64) point { return point{0, 0, 0} } +// the generate handler gets a number of stars and a range in which the stars should be generated +// and generated them func generateHandler(w http.ResponseWriter, r *http.Request) { params := r.URL.Query() + // parse the url arguments amount, _ := strconv.ParseInt(params.Get("num"), 10, 64) galaxyRange, _ := strconv.ParseFloat(params.Get("range"), 64) // generate the given amount of stars for i := 0; i < int(amount); i++ { + + // generate the star result := gen(galaxyRange) + log.Printf("galaxy range: %f", galaxyRange) log.Printf("%v\n", result) _, err := fmt.Fprintf(w, "%f, %f, %f\n", result.x, result.y, result.z) |