diff options
| author | Horus_Arch | 2015-02-23 12:13:32 +0100 |
|---|---|---|
| committer | Horus_Arch | 2015-02-23 12:13:32 +0100 |
| commit | 70d080b69a1bce3125d8d0b83e23775880241763 (patch) | |
| tree | 6fac80f9291e361045098b2ce9eb0839652e6b42 /app/handler.go | |
| parent | 00b28812fb5ab68156ead5b45b66740a4d5ca688 (diff) | |
| download | statuspage-70d080b69a1bce3125d8d0b83e23775880241763.tar.gz | |
Refactor and more unit tests.
Diffstat (limited to 'app/handler.go')
| -rw-r--r-- | app/handler.go | 9 |
1 files changed, 3 insertions, 6 deletions
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) { |
