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,
|
methods []string,
|
||||||
) Handler {
|
) Handler {
|
||||||
var tmpl *template.Template
|
var tmpl *template.Template
|
||||||
if file != "" {
|
//if file != "" {
|
||||||
tmpl = template.Must(template.ParseFiles(fmt.Sprintf("templates/%s", file)))
|
// tmpl = template.Must(template.ParseFiles(fmt.Sprintf("templates/%s", file)))
|
||||||
}
|
//}
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
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 {
|
for _, method := range methods {
|
||||||
if method == r.Method {
|
if method == r.Method {
|
||||||
goto ok
|
goto ok
|
||||||
|
|
Reference in a new issue