restructure
This commit is contained in:
24
services/http.go
Normal file
24
services/http.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package http
|
||||
|
||||
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:"route"`
|
||||
}
|
||||
|
||||
func ServeHttp() error {
|
||||
return container.Container.Invoke(func(http Http) error {
|
||||
for _, route := range http.Routes {
|
||||
route.Register()
|
||||
}
|
||||
|
||||
return http.Service.Serve()
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user