Skip to content

Instantly share code, notes, and snippets.

@antklim
Last active November 19, 2020 03:34
Show Gist options
  • Select an option

  • Save antklim/fd2d1314beac45fbda67dbd22c8be84d to your computer and use it in GitHub Desktop.

Select an option

Save antklim/fd2d1314beac45fbda67dbd22c8be84d to your computer and use it in GitHub Desktop.
func Start(address string) error {
mux := http.NewServeMux()
client := &http.Client{}
for route, handler := range Routes(client) {
mux.Handle(route, handler)
}
s := &http.Server{
Addr: address,
Handler: mux,
ReadTimeout: 10 * time.Second,
WriteTimeout: 10 * time.Second,
MaxHeaderBytes: 1 << 20,
}
log.Printf("calc service is listening at %s", address)
return s.ListenAndServe()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment