Skip to content

Commit

Permalink
grpcgateway
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Dec 10, 2024
1 parent b69e5cd commit dbe76eb
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions server/v2/api/grpcgateway/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ func New[T transaction.Tx](

s.logger = logger.With(log.ModuleKey, s.Name())
s.config = serverCfg
mux := http.NewServeMux()
mux.Handle("/", s.GRPCGatewayRouter)

s.server = &http.Server{
Addr: s.config.Address,
Handler: mux,
}
return s, nil
}

Expand Down Expand Up @@ -110,14 +116,6 @@ func (s *Server[T]) Start(ctx context.Context) error {
return nil
}

mux := http.NewServeMux()
mux.Handle("/", s.GRPCGatewayRouter)

s.server = &http.Server{
Addr: s.config.Address,
Handler: mux,
}

s.logger.Info("starting gRPC-Gateway server...", "address", s.config.Address)
if err := s.server.ListenAndServe(); err != nil && err != http.ErrServerClosed {
return fmt.Errorf("failed to start gRPC-Gateway server: %w", err)
Expand Down

0 comments on commit dbe76eb

Please sign in to comment.