about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmile <hanemile@protonmail.com>2019-10-19 17:31:28 +0200
committerEmile <hanemile@protonmail.com>2019-10-19 17:31:28 +0200
commita088c2b56cf56dccd9e4bf3ec55cd23391ba298f (patch)
treed0c2cb2b2717a8182f36447ded4f2e873b2f5c47
parente570ebaf7a49673238c176b3dd82bf239703d1f1 (diff)
cleaned stuff
-rw-r--r--src/http.go17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/http.go b/src/http.go
index 88326fc..e08ed68 100644
--- a/src/http.go
+++ b/src/http.go
@@ -54,8 +54,6 @@ func viewGetHandler(w http.ResponseWriter, r *http.Request) {
 	// get all challenges from the db
 	challs := getAllChallenges(db)
 
-	log.Println("got all challenges")
-
 	// define a challenges struct storing the challenges.
 	// This struct can be used in a template
 	challenges := Challenges{}
@@ -64,12 +62,7 @@ func viewGetHandler(w http.ResponseWriter, r *http.Request) {
 		challenges.Challenge = append(challenges.Challenge, chal)
 	}
 
-	log.Println("Done inserting all the challengesi nto the challenges struct")
-
-	fmt.Printf("challenges: %#v\n", challenges)
-
-	log.Println("Generating a new template used to render the challenges")
-
+	// define a new template to render the challenges in
 	t := template.New("")
 	t, err := t.ParseFiles("./hosted/view.html")
 	if err != nil {
@@ -77,14 +70,8 @@ func viewGetHandler(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	log.Println("Done generating and parsing the template")
-
+	// execure the template using the challenges struct
 	t.ExecuteTemplate(w, "view", challenges)
-
-	log.Println("Done executing the template")
-
-	// read the view.html file and write its content to the response writer
-	//readFileToResponse(w, "/view.html")
 }
 
 func editGetHandler(w http.ResponseWriter, r *http.Request) {