Пример #1
0
func init() {
	services.Init()
	gob.Register(services.MapUrlServiceCount{}) // for services.Refresh

	handler := web.BuildHandler(utilsFunc, false)
	http.Handle("/", handler)
}
Пример #2
0
func main() {
	services.Init()
	handler := web.BuildHandler(utilsFunc, true)

	port := os.Getenv("PORT")
	if len(port) == 0 {
		port = "8080"
	}

	fmt.Printf("Listening on %s...\n", port)
	log.Fatal(http.ListenAndServe(":"+port, handler))
}