|
|
@ -15,11 +15,14 @@ func GenerateHandler(
|
|
|
|
methods []string,
|
|
|
|
methods []string,
|
|
|
|
) Handler {
|
|
|
|
) Handler {
|
|
|
|
var tmpl *template.Template
|
|
|
|
var tmpl *template.Template
|
|
|
|
|
|
|
|
//if file != "" {
|
|
|
|
|
|
|
|
// tmpl = template.Must(template.ParseFiles(fmt.Sprintf("templates/%s", file)))
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
|
|
|
// Remove in production, enables live template reloading
|
|
|
|
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) {
|
|
|
|
|
|
|
|
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
|
|
|
|