Last active
November 23, 2020 06:40
-
-
Save antklim/4fc9140f02ac8aba42b6a36fab8ac456 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func Start(address string, routes map[string]http.HandlerFunc) error { | |
mux := http.NewServeMux() | |
for route, handler := range routes { | |
mux.Handle(route, handler) | |
} | |
s := &http.Server{ | |
Addr: address, | |
Handler: mux, | |
ReadTimeout: 10 * time.Second, | |
WriteTimeout: 10 * time.Second, | |
MaxHeaderBytes: 1 << 20, | |
} | |
return s.ListenAndServe() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment