1
0
Fork 0
mirror of https://github.com/Luzifer/go-holidays.git synced 2024-12-25 05:11:17 +00:00

Ensure short living connections

This commit is contained in:
Knut Ahlers 2017-02-02 11:28:37 +01:00
parent 92899c5512
commit 9d17d8617e
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -44,7 +44,14 @@ func main() {
r.HandleFunc("/{country-code:[a-z-]+}/{year:[0-9]{4}}", handleHolidays) r.HandleFunc("/{country-code:[a-z-]+}/{year:[0-9]{4}}", handleHolidays)
r.HandleFunc("/{country-code:[a-z-]+}", handleHolidays) r.HandleFunc("/{country-code:[a-z-]+}", handleHolidays)
r.HandleFunc("/", handleReadme) r.HandleFunc("/", handleReadme)
http.ListenAndServe(cfg.Listen, r)
srv := &http.Server{
Addr: cfg.Listen,
Handler: r,
ReadTimeout: time.Second,
WriteTimeout: time.Second,
}
log.Println(srv.ListenAndServe())
} }
func handleHolidays(res http.ResponseWriter, r *http.Request) { func handleHolidays(res http.ResponseWriter, r *http.Request) {