refactor: use go:embed for templates
Templates are now embedded using //go:embed and parsed once at startup with template.Must(template.ParseFS(...)). This avoids re-parsing template files from disk on every request and removes the dependency on template files being present at runtime. closes #7
This commit is contained in:
@@ -34,7 +34,7 @@ func (s *Handlers) HandleIndex() http.HandlerFunc {
|
||||
}
|
||||
|
||||
// Render the template
|
||||
s.renderTemplate(w, req, []string{"templates/base.html", "templates/index.html"}, data)
|
||||
s.renderTemplate(w, req, "index.html", data)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user