Exemplo n.º 1
0
func main() {
	redis_client = redis.New("127.0.0.1:6379")

	queue_name_re := "([a-zA-Z0-9]+)$"
	remux.HandleFunc("^/$", IndexHandler)
	remux.HandleFunc("^/q/"+queue_name_re, queueHandler)
	server := http.Server{
		Addr:    ":8080",
		Handler: remux.DefaultServeMux,
		Logger:  logger,
	}
	server.ListenAndServe()

}
Exemplo n.º 2
0
func main() {
	remux.HandleFunc("^/$", IndexHandler)
	remux.HandleFunc("^/static/(.*)$", StaticHandler)
	remux.HandleFunc("^/(crossdomain.xml)$", StaticHandler)
	remux.HandleFunc("^/(csv|json|xml)/(.*)$", makeHandler())
	server := http.Server{
		Addr:         listenOn,
		Handler:      remux.DefaultServeMux,
		Logger:       logger,
		ReadTimeout:  15 * time.Second,
		WriteTimeout: 15 * time.Second,
	}
	log.Println("FreeGeoIP server starting")
	if e := server.ListenAndServe(); e != nil {
		log.Println(e.Error())
	}
}