Files
atom/services/http.go
yanghao05 d28d9649ed add close
2023-06-01 11:02:10 +08:00

27 lines
429 B
Go

package services
import (
"github.com/rogeecn/atom/container"
"github.com/rogeecn/atom/providers/http"
"go.uber.org/dig"
)
type Http struct {
dig.In
Service http.Service
Routes []http.Route `group:"routes"`
}
func ServeHttp() error {
defer container.Close()
return container.Container.Invoke(func(http Http) error {
for _, route := range http.Routes {
route.Register()
}
return http.Service.Serve()
})
}