func main() { g = goat.NewGoat() database := os.Getenv("MONGOHQ_URL") if database == "" { database = "localhost" } update_counter = updateInterval g.RegisterMiddleware(g.NewDatabaseMiddleware(database, "hotdog_locations")) g.RegisterRoute("/deathpoints/{player}", "deathpoints", goat.GET, handleDeathpoints) g.RegisterRoute("/locations/{player}", "locations", goat.GET, handlePlayerLocations) g.RegisterRoute("/", "socket", goat.GET, websocket.Server{ Handler: handleSocket, }) db = g.CloneDB() pool = NewConnectionPool() go pool.run() g.ListenAndServe("5000") }
func main() { g = goat.NewGoat() g.RegisterRoute("/", "socket", goat.GET, websocket.Server{ Handler: handleSocket, }) pool = NewConnectionPool() go pool.run() go g.ListenAndServe("5050") readInput() }