Beispiel #1
0
func main() {
	mux := routes.New()
	mux.Get("/:last/:first", Whoami)

	http.Handle("/", mux)
	http.ListenAndServe(":8080", nil)
}
Beispiel #2
0
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)
}
Beispiel #3
0
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)
	}
}