示例#1
0
文件: main.go 项目: raymyers/gorunner
func main() {
	wd, _ := os.Getwd()
	println("Working directory", wd)

	// start the server and routes
	server := &http.Server{Addr: port, Handler: nil}
	setupRoutes()
	models.InitDatabase()
	http.HandleFunc("/", gateway)

	go func() {
		for {
			fmt.Println("Running on " + port)
			l, e := net.Listen("tcp", port)
			if e != nil {
				panic(e)
			}
			defer l.Close()
			server.Serve(l)
		}
	}()

	select {}

	println("Dead")
}
示例#2
0
文件: main.go 项目: jcarley/gorunner
func main() {
	wd, _ := os.Getwd()
	println("Working directory", wd)

	hub.NewHub(getRecentRuns)
	go hub.Run()

	// start the server and routes
	server := &http.Server{Addr: port, Handler: nil}
	r = mux.NewRouter()
	handlers.Install(r)
	models.InitDatabase()
	http.HandleFunc("/", filter)

	fmt.Println("Running on " + port)
	l, e := net.Listen("tcp", port)
	if e != nil {
		panic(e)
	}
	defer l.Close()
	server.Serve(l)
}