summary refs log tree commit diff stats
path: root/handlers.go
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-05-13 17:42:32 -0400
committerBen Morrison <ben@gbmor.dev>2019-05-13 22:13:54 -0400
commit920306cbcad3df05e01699cd19f3767e069ab139 (patch)
tree32d8990ad80f5ce4e47b1ff0acdc0e1479bd43bd /handlers.go
parent61d34d492a6baab8e2aa420c1b1d0a562624b7d1 (diff)
downloadgetwtxt-920306cbcad3df05e01699cd19f3767e069ab139.tar.gz
template initialization added
Diffstat (limited to 'handlers.go')
-rw-r--r--handlers.go8
1 files changed, 5 insertions, 3 deletions
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
 	}
 
 }