Jeffrey Paul
61228b4586
Some checks failed
continuous-integration/drone/push Build is failing
Co-authored-by: sneak <sneak@sneak.berlin> Reviewed-on: #14
22 lines
467 B
Go
22 lines
467 B
Go
package server
|
|
|
|
import (
|
|
"html/template"
|
|
"log"
|
|
"net/http"
|
|
|
|
"git.eeqj.de/sneak/gohttpserver/templates"
|
|
)
|
|
|
|
func (s *server) handleIndex() http.HandlerFunc {
|
|
indexTemplate := template.Must(template.New("index").Parse(templates.MustString("index.html")))
|
|
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
err := indexTemplate.ExecuteTemplate(w, "index", nil)
|
|
if err != nil {
|
|
log.Println(err.Error())
|
|
http.Error(w, http.StatusText(500), 500)
|
|
}
|
|
}
|
|
}
|