zdravko/internal/handlers/index.go

25 lines
498 B
Go
Raw Normal View History

package handlers
import (
"net/http"
"text/template"
"code.tjo.space/mentos1386/zdravko/web/templates"
)
func (h *BaseHandler) Index(w http.ResponseWriter, r *http.Request) {
ts, err := template.ParseFS(templates.Templates,
2024-02-11 10:56:21 +00:00
"components/base.tmpl",
"pages/index.tmpl",
)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
err = ts.ExecuteTemplate(w, "base", nil)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
}