mr-chenguang lcgash пре 4 месеци
родитељ
комит
7bb0b42c88
2 измењених фајлова са 19 додато и 1 уклоњено
  1. 11 0
      .gitpod.yml
  2. 8 1
      internal/server/http_server.go

+ 11 - 0
.gitpod.yml

@@ -0,0 +1,11 @@
+# This configuration file was automatically generated by Gitpod.
+# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
+# and commit this file to your remote git repository to share the goodness with others.
+
+# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart
+
+tasks:
+  - init: go get && go build ./... && go test ./...
+    command: go run .
+
+

+ 8 - 1
internal/server/http_server.go

@@ -18,7 +18,14 @@ import (
 
 // server starts a http server and returns a function to stop it
 func (app *App) server(config *app.Config) func() {
-	engine := gin.Default()
+	engine := gin.New()
+
+	engine.Use(
+		gin.LoggerWithConfig(gin.LoggerConfig{
+			SkipPaths: []string{"/health/check"},
+		}),
+		gin.Recovery(),
+	)
 	engine.GET("/health/check", controllers.HealthCheck(config))
 
 	endpointGroup := engine.Group("/e")