added batman in homepage
This commit is contained in:
parent
e84579e773
commit
2bb006339d
1 changed files with 13 additions and 0 deletions
13
main.go
13
main.go
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue