Static files handler

This commit is contained in:
2016-07-01 22:37:39 +05:00
parent 25e7c31f8e
commit 40aec78068

View File

@@ -103,8 +103,6 @@ func main() {
} else {
http.HandleFunc("/noolite/", func(w http.ResponseWriter, r *http.Request) {
command, channel, value, red, green, blue := parseParams(r.URL.Path[1:])
fmt.Fprintf(w, "Command: %q\n", command)
fmt.Fprintf(w, "Channel: %d\n", channel)
err := sendCommand(command, channel, value, red, green, blue)
@@ -113,6 +111,8 @@ func main() {
}
})
panic(http.ListenAndServe(fmt.Sprintf(":%d", *http_port), nil))
fs := http.FileServer(http.Dir("/var/www/static"))
panic(http.ListenAndServe(fmt.Sprintf(":%d", *http_port), fs))
}
}