Improve the way we launch the server
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing

This commit is contained in:
Grégoire Delattre 2020-03-01 16:29:56 +01:00
parent 09eb97b235
commit 8676ca4df9

View File

@ -22,8 +22,7 @@ import (
func main() { func main() {
if err := run(); err != nil { if err := run(); err != nil {
// TODO: handle this fmt.Fprintf(os.Stderr, "error while running the app: %s\n", err.Error())
panic(err)
} }
} }
@ -119,7 +118,9 @@ func run() error {
// Compress responses // Compress responses
n.Use(gzip.Gzip(gzip.DefaultCompression)) n.Use(gzip.Gzip(gzip.DefaultCompression))
n.UseHandler(env.Router) n.UseHandler(env.Router)
n.Run(":" + cf.Port)
return nil addr := ":" + cf.Port
env.Log.Infof("listening on %s", addr)
return http.ListenAndServe(addr, n)
} }