diff --git a/httputils/handler.go b/httputils/handler.go index 31bf89b..de941ce 100644 --- a/httputils/handler.go +++ b/httputils/handler.go @@ -15,11 +15,14 @@ func GenerateHandler( methods []string, ) Handler { var tmpl *template.Template - if file != "" { - tmpl = template.Must(template.ParseFiles(fmt.Sprintf("templates/%s", file))) - } + //if file != "" { + // tmpl = template.Must(template.ParseFiles(fmt.Sprintf("templates/%s", file))) + //} return func(w http.ResponseWriter, r *http.Request) { - tmpl = template.Must(template.ParseFiles(fmt.Sprintf("templates/%s", file))) + // Remove in production, enables live template reloading + if file != "" { + tmpl = template.Must(template.ParseFiles(fmt.Sprintf("templates/%s", file))) + } for _, method := range methods { if method == r.Method { goto ok