You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

17 lines
377 B

package handlers
import (
"html/template"
"net/http"
)
type HomeHandler struct {
Tmpl *template.Template
}
func (h *HomeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
data := struct{ Title string }{Title: "Title"}
if err := h.Tmpl.ExecuteTemplate(w, "index.html", data); err != nil {
http.Error(w, "Template Error", http.StatusInternalServerError)
}
}