From 920306cbcad3df05e01699cd19f3767e069ab139 Mon Sep 17 00:00:00 2001 From: Ben Morrison Date: Mon, 13 May 2019 17:42:32 -0400 Subject: template initialization added --- handlers.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'handlers.go') diff --git a/handlers.go b/handlers.go index 3b23761..961ac4f 100644 --- a/handlers.go +++ b/handlers.go @@ -15,9 +15,11 @@ import ( // handles "/" func indexHandler(w http.ResponseWriter, _ *http.Request) { w.Header().Set("Content-Type", htmlutf8) - n, err := w.Write([]byte("getwtxt v" + getwtxt)) - if err != nil || n == 0 { - log.Printf("Error writing to HTTP stream: %v bytes, %v\n", n, err) + err := tmpls.ExecuteTemplate(w, "index.html", confObj.Instance) + if err != nil { + log.Printf("Error writing to HTTP stream: %v\n", err) + http.Error(w, err.Error(), http.StatusInternalServerError) + return } } -- cgit 1.4.1-2-gfad0