func init() {
	session, err := mgo.Dial(fmt.Sprintf("%s:%s@localhost:%s", gofig.Str("mongoUsername"), gofig.Str("mongoPassword"), gofig.Str("mongoPort")))
	if err != nil {
		panic(err)
	}
	session.SetMode(mgo.Monotonic, true)
	collection = session.DB("risk").C("battleResults")
}
Beispiel #2
0
func main() {
	router := mux.NewRouter()
	router.HandleFunc("/", homeHandler).Methods("GET")
	router.Handle("/BattleRequest", dependencyHandler(battleRequestHandler)).Methods("POST")

	http.Handle("/", router)
	http.HandleFunc("/static/", func(w http.ResponseWriter, r *http.Request) {
		http.ServeFile(w, r, r.URL.Path[1:])
	})

	panic(http.ListenAndServe(gofig.Str("webPort"), nil))
}