Exemplo n.º 1
0
func main() {
	sqlrepositories.Connect(config.DatabaseConnectionString())
	defer sqlrepositories.Cleanup()

	sessions.Enable()

	setupDependencies()

	http.Handle("/assets/", http.StripPrefix("/assets/", http.FileServer(http.Dir("./assets"))))

	http.HandleFunc("/favicon.ico", func(req http.ResponseWriter, res *http.Request) {
		http.ServeFile(req, res, "./assets/images/favicon.png")
	})

	http.HandleFunc("/robots.txt", func(req http.ResponseWriter, res *http.Request) {
		http.ServeFile(req, res, "./assets/robots.txt")
	})

	setupRouting()

	http.Handle("/", r)

	port := portFromEnvOrDefault()
	log.Println("Starting server on port", port)
	log.Fatal(http.ListenAndServe(":"+port, nil))
}
Exemplo n.º 2
0
func main() {
	sqlrepositories.Connect(config.DatabaseConnectionString())
	defer sqlrepositories.Cleanup()

	sessions.Enable()

	setupDependencies()

	setupRouting()

	http.Handle("/", r)
	http.Handle("/assets/", http.StripPrefix("/assets/", http.FileServer(http.Dir("./assets"))))

	port := portFromEnvOrDefault()
	log.Println("Starting server on port", port)
	log.Fatal(http.ListenAndServe(":"+port, nil))
}