modify routes

This commit is contained in:
yanghao05
2023-06-09 14:58:29 +08:00
parent 3f27dee0b2
commit aee21ec772
7 changed files with 46 additions and 17 deletions

View File

@@ -2,6 +2,7 @@ package services
import (
"github.com/rogeecn/atom/container"
"github.com/rogeecn/atom/contracts"
"github.com/rogeecn/atom/providers/http"
"go.uber.org/dig"
)
@@ -9,18 +10,15 @@ import (
type Http struct {
dig.In
Service http.Service
Routes []http.Route `group:"routes"`
Service http.Service
Initials []contracts.Initial `group:"initials"`
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()
})
}