gohttpserver/httpserver/handleindex.go
sneak 7cc2628b05
Some checks failed
continuous-integration/drone/push Build is failing
now uses rice
2020-10-28 17:47:37 -07:00

20 lines
432 B
Go

package httpserver
import (
"html/template"
"log"
"net/http"
)
func (s *server) handleIndex() http.HandlerFunc {
indexTemplate := template.Must(template.New("index").Parse(s.templateFiles.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)
}
}
}