|
@@ -1,8 +1,21 @@
|
|
package web
|
|
package web
|
|
|
|
|
|
-import "net/http"
|
|
|
|
|
|
+import (
|
|
|
|
+ "io"
|
|
|
|
+ "log"
|
|
|
|
+ "net/http"
|
|
|
|
+ "strings"
|
|
|
|
+)
|
|
|
|
|
|
// handleGetRoot handles path /
|
|
// handleGetRoot handles path /
|
|
func handleGetRoot(w http.ResponseWriter, r *http.Request) {
|
|
func handleGetRoot(w http.ResponseWriter, r *http.Request) {
|
|
- w.Write([]byte("Hello Kurz"))
|
|
|
|
|
|
+ sw := &strings.Builder{}
|
|
|
|
+ err := tmpl.ExecuteTemplate(sw, "home", nil)
|
|
|
|
+ if err != nil {
|
|
|
|
+ log.Println(err)
|
|
|
|
+ w.WriteHeader(http.StatusInternalServerError)
|
|
|
|
+ } else {
|
|
|
|
+ w.WriteHeader(http.StatusOK)
|
|
|
|
+ io.Copy(w, strings.NewReader(sw.String()))
|
|
|
|
+ }
|
|
}
|
|
}
|