package main import ( "flag" "fmt" "log" "net/http" "golang.org/x/net/websocket" ) var addr = flag.String("addr", ":8666", "http service address") var static_files = flag.String("static", "./static", "location of static files") func main() { flag.Parse() http.Handle("/", http.FileServer(http.Dir( fmt.Sprintf("%s/html", *static_files)))) http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir(*static_files)))) http.Handle("/ws/game/", websocket.Handler(addPlayer)) go g.run() err := http.ListenAndServe(*addr, nil) if err != nil { log.Fatal("unable to start server") } }