ascii-live/main.go

33 lines
635 B
Go
Raw Normal View History

2019-11-19 05:51:48 +00:00
package main
import (
"flag"
"net/http"
"github.com/golang/glog"
"github.com/gorilla/mux"
)
// Server.
func main() {
flag.Parse()
// Don't write to /tmp - doesn't work in docker scratch
flag.Set("logtostderr", "true")
r := mux.NewRouter()
r.HandleFunc("/ascii-live/list", ListHandler).Methods("GET")
r.HandleFunc("/ascii-live/{frameSource}", Handler).Methods("GET")
r.NotFoundHandler = http.HandlerFunc(NotFoundHandler)
2019-11-19 05:51:48 +00:00
srv := &http.Server{
Handler: r,
Addr: ":8080",
// Set unlimited read/write timeouts
ReadTimeout: 0,
WriteTimeout: 0,
}
glog.Infof("Serving...")
glog.Fatal(srv.ListenAndServe())
}