func main() {
	if err := db.Connect(os.Getenv("DBHOST"), os.Getenv("DBNAME")); err != nil {
		log.Fatal(err)
	}

	http.Handle("/", handlers.CombinedLoggingHandler(os.Stderr, router))

	log.Printf("Listening on :%s", os.Getenv("PORT"))
	panic(http.ListenAndServe(":"+os.Getenv("PORT"), nil))
}
Exemple #2
0
func main() {
	var err error

	if logOut, err = os.OpenFile("/tmp/access.log", os.O_CREATE|os.O_APPEND, 0666); err != nil {
		log.Fatal(err)
	}
	defer logOut.Close()

	if err = db.Connect(os.Getenv("DBHOST"), os.Getenv("DBNAME")); err != nil {
		log.Fatal(err)
	}

	http.Handle("/", handlers.CombinedLoggingHandler(logOut, router))
	assetHandler()

	log.Printf("Listening on :%s", os.Getenv("PORT"))
	panic(http.ListenAndServe(":"+os.Getenv("PORT"), nil))
}