feat: added healthcheck

This commit is contained in:
ITQ
2025-11-11 21:39:01 +03:00
parent a2345bedac
commit 2c5b1c1dd6
2 changed files with 69 additions and 1 deletions
+6 -1
View File
@@ -11,6 +11,7 @@ import (
"orderservice/internal/interceptor"
grpcHandlers "orderservice/internal/handler/grpc"
httpHandlers "orderservice/internal/handler/http"
orderPostgresRepo "orderservice/internal/repository/postgres"
"orderservice/internal/service"
@@ -57,8 +58,12 @@ func runHTTPHandler(s *Server, grpcServerEndpoint *string) error {
return err
}
mux := http.NewServeMux()
mux.Handle("/healthz", httpHandlers.NewHealthHandler(s.db, s.redisDB))
mux.Handle("/", gwmux)
addr := fmt.Sprintf(":%d", s.config.HTTPPort)
return http.ListenAndServe(addr, gwmux)
return http.ListenAndServe(addr, mux)
}
func getDatabase(cfg config.Config) (*sqlx.DB, error) {