From 8676ca4df980643c0c6e5eab7e997ae466d6e7a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Delattre?= Date: Sun, 1 Mar 2020 16:29:56 +0100 Subject: [PATCH] Improve the way we launch the server --- backend/main.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/main.go b/backend/main.go index c90c5b0..d152ec8 100644 --- a/backend/main.go +++ b/backend/main.go @@ -22,8 +22,7 @@ import ( func main() { if err := run(); err != nil { - // TODO: handle this - panic(err) + fmt.Fprintf(os.Stderr, "error while running the app: %s\n", err.Error()) } } @@ -119,7 +118,9 @@ func run() error { // Compress responses n.Use(gzip.Gzip(gzip.DefaultCompression)) 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) } -- 2.47.1