package main import ( "flag" "fmt" "log" "net/http" "github.com/gorilla/mux" ) var ( categories []string port int ) func main() { initFlags() r := mux.NewRouter() r.HandleFunc("/", indexHandler) r.HandleFunc("/dumpall", dumpallHandler) r.HandleFunc("/{station}/{name}", getHandler) log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", port), r)) } func initFlags() { flag.IntVar(&port, "p", 8080, "the port the server should listen on") flag.Parse() }