adding error handling for all DB calls. Returning StatusInternalServerError whenever an error occurs. Adding additional logging to server handlers.

Make sure we "return" after a c.JSON call.
This commit is contained in:
Jason Kulatunga
2020-09-23 09:54:33 -06:00
parent 531fea76b2
commit 6a20228262
6 changed files with 68 additions and 28 deletions
@@ -51,6 +51,7 @@ func LoggerMiddleware(logger logrus.FieldLogger) gin.HandlerFunc {
path := c.Request.URL.Path
blw := &responseBodyLogWriter{body: &bytes.Buffer{}, ResponseWriter: c.Writer}
c.Writer = blw
c.Set("LOGGER", logger)
start := time.Now()
c.Next()
stop := time.Since(start)