Ejemplo n.º 1
0
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")
}
Ejemplo n.º 2
0
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)
}