added batman in homepage

This commit is contained in:
Claudio La Barbera 2023-03-22 15:29:40 +01:00
parent e84579e773
commit 2bb006339d

13
main.go
View file

@ -57,7 +57,19 @@ func handler(w http.ResponseWriter, r *http.Request) {
flusher := w.(http.Flusher)
vars := mux.Vars(r)
frameSource := vars["frameSource"]
returnFrames(w, r, cn, flusher, frameSource)
}
func homeHandler(w http.ResponseWriter, r *http.Request) {
cn := w.(http.CloseNotifier)
flusher := w.(http.Flusher)
returnFrames(w, r, cn, flusher, "batman")
}
func returnFrames(w http.ResponseWriter, r *http.Request, cn http.CloseNotifier, flusher http.Flusher, frameSource string) {
glog.Infof("Frame source %s", frameSource)
frames, ok := frames.FrameMap[frameSource]
@ -110,6 +122,7 @@ func main() {
flag.Set("logtostderr", "true")
r := mux.NewRouter()
r.HandleFunc("/", homeHandler).Methods("GET")
r.HandleFunc("/list", listHandler).Methods("GET")
r.HandleFunc("/{frameSource}", handler).Methods("GET")
r.NotFoundHandler = http.HandlerFunc(notFoundHandler)