generated from ElnuDev/go-project
Add clarification for debug template reloading
This commit is contained in:
parent
01204ffc81
commit
e00df6aac6
1 changed files with 7 additions and 4 deletions
|
@ -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
|
||||
|
|
Reference in a new issue