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:
parent
92899c5512
commit
9d17d8617e
1 changed files with 8 additions and 1 deletions
|
@ -44,7 +44,14 @@ func main() {
|
|||
r.HandleFunc("/{country-code:[a-z-]+}/{year:[0-9]{4}}", handleHolidays)
|
||||
r.HandleFunc("/{country-code:[a-z-]+}", handleHolidays)
|
||||
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) {
|
||||
|
|
Loading…
Reference in a new issue