From 999660a588f5a8a6c622df2e4f2d03445abfb3f0 Mon Sep 17 00:00:00 2001 From: jan Date: Sat, 19 Dec 2015 18:47:24 +0100 Subject: #tamtam index diff --git a/main.go b/main.go index ba1d012..c0b1d23 100644 --- a/main.go +++ b/main.go @@ -11,6 +11,12 @@ import ( _ "github.com/lib/pq" ) +var renderer *frontend.Renderer + +func index(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { + renderer.RenderPage("index", w, make(map[string]interface{})) +} + func main() { // Datenbankverbindung aufbauen db, err := sql.Open("postgres", "host=grilist.moe user=grilist dbname=grilist password=grilist sslmode=disable") @@ -19,13 +25,14 @@ func main() { } log.Println("database connection established") - frontend := frontend.New("views") + renderer = frontend.New("views") charakterin := login.New(db) - charakterin.UseRenderer(frontend) + charakterin.UseRenderer(renderer) router := httprouter.New() router.HandlerFunc("GET", "/login", charakterin.DisplayLogin) router.HandlerFunc("POST", "/login", charakterin.Login) + router.GET("/", index) fs := http.FileServer(http.Dir("assets")) http.Handle("/assets/", http.StripPrefix("/assets/", fs)) diff --git a/views/index.html b/views/index.html new file mode 100644 index 0000000..fd8c87f --- /dev/null +++ b/views/index.html @@ -0,0 +1,44 @@ +{{ define "index" }} + + + + grilist + + + + +
+
+

grilist
#tamtam

+
+
+ + +{{ end }} \ No newline at end of file -- cgit v0.10.1