diff options
-rw-r--r-- | main.go | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -23,7 +23,7 @@ func main() { log.Fatal(err) } - http.HandleFunc("/", index(config.Devices)) + http.HandleFunc("/", index) http.HandleFunc("/api", api) http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.FS(static)))) @@ -46,13 +46,11 @@ func parseFlags() string { } // index() returns a HTTP handler for the index page. -func index(devices DevicesConfig) func(http.ResponseWriter, *http.Request) { - return func(w http.ResponseWriter, r *http.Request) { - err := templates.Execute(w, devices) - if err != nil { - http.Error(w, fmt.Sprint(err), http.StatusInternalServerError) - return - } +func index(w http.ResponseWriter, r *http.Request) { + err := templates.Execute(w, config.Devices) + if err != nil { + http.Error(w, fmt.Sprint(err), http.StatusInternalServerError) + return } } |