niki/domain/payment/delivery/http/server.go

35 lines
634 B
Go

package http
import (
"context"
httpserver "git.gocasts.ir/ebhomengo/niki/pkg/http_server"
)
type Server struct {
httpServer httpserver.Server
handler *Handler
}
func NewServer(httpServer httpserver.Server, handler *Handler) *Server {
return &Server{
httpServer: httpServer,
handler: handler,
}
}
func (s *Server) Serve() error {
s.registerRoutes()
return s.httpServer.Start()
}
func (s *Server) Stop(ctx context.Context) error {
return s.httpServer.Stop(ctx)
}
func (s *Server) registerRoutes() {
paymentGroup := s.httpServer.Router.Group("/payment")
paymentGroup.GET("/health", s.handler.HealthCheck)
}