From 70d080b69a1bce3125d8d0b83e23775880241763 Mon Sep 17 00:00:00 2001 From: Horus_Arch Date: Mon, 23 Feb 2015 12:13:32 +0100 Subject: Refactor and more unit tests. --- app/handler.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'app/handler.go') diff --git a/app/handler.go b/app/handler.go index 9a3352f..510514a 100644 --- a/app/handler.go +++ b/app/handler.go @@ -1,17 +1,14 @@ package main import ( - "fmt" - // "html/template" "encoding/json" + "fmt" "github.com/garyburd/redigo/redis" "log" "net/http" ) func IndexHandler(w http.ResponseWriter, r *http.Request) { - log.Println("Print IndexHandler") - hosts := []Host{} c := pool.Get() @@ -23,10 +20,12 @@ func IndexHandler(w http.ResponseWriter, r *http.Request) { if err != nil { log.Println("Error JSON decoding: ", err) Db.Find(&hosts) + CacheHosts(cache_prefix+"database", hosts) } } else { log.Println("Redis: ", err) Db.Find(&hosts) + CacheHosts(cache_prefix+"database", hosts) } index := mainTempl.Lookup("index.html") @@ -40,13 +39,11 @@ func IndexHandler(w http.ResponseWriter, r *http.Request) { func RegisterHandler(w http.ResponseWriter, r *http.Request) { log.Println("Processing registration!") fmt.Fprintf(w, "Processing registration! \n") - // w.Write() } func PrintRegisterHandler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Printing register etc! \n") - // w.Write() } func PrintNewJobHandler(w http.ResponseWriter, r *http.Request) { -- cgit v1.2.3