ascii-live/main.go
franz.germann fd124f2a5d
Some checks failed
ci / build (push) Failing after 40s
extracts handler functions from main.go
2025-03-26 18:41:30 +01:00

32 lines
635 B
Go

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)
srv := &http.Server{
Handler: r,
Addr: ":8080",
// Set unlimited read/write timeouts
ReadTimeout: 0,
WriteTimeout: 0,
}
glog.Infof("Serving...")
glog.Fatal(srv.ListenAndServe())
}