func main() { mux := routes.New() mux.Get("/:last/:first", Whoami) http.Handle("/", mux) http.ListenAndServe(":8080", nil) }
func (p *Proxy) machineHandler(w http.ResponseWriter, r *http.Request) { mux := routes.New() mux.Get("/config", func(w http.ResponseWriter, r *http.Request) { p.configHandler(w, r) }) //mux.Get("/machine/create", p.createVmHandler) mux.Get("/machine/:uuid/:op", func(w http.ResponseWriter, r *http.Request) { p.machineInstanceHandler(w, r) }) mux.ServeHTTP(w, r) }
func main() { allGames["0"] = InitGame(5, "not used yet") allGames["0"].SendDelta(os.Stdout, 1, nil) mux := routes.New() mux.Get("/create", CreateUIHandler) mux.Post("/create", CreateHandler) mux.Get("/game/:id/play", GameHandler) mux.Post("/game/:id/api/:method", ApiHandler) http.Handle("/assets/", http.FileServer(http.Dir("."))) http.Handle("/maps/", http.FileServer(http.Dir("."))) http.Handle("/", mux) err := http.ListenAndServe(":8088", nil) if err != nil { fmt.Println("Unable to start server:", err) os.Exit(1) } }