add backend tpl
This commit is contained in:
13
backend/services/default.go
Normal file
13
backend/services/default.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"backend/providers/http/fiber"
|
||||
|
||||
"git.ipao.vip/rogeecn/atom/container"
|
||||
)
|
||||
|
||||
func Default(providers ...container.ProviderContainer) container.Providers {
|
||||
return append(container.Providers{
|
||||
fiber.DefaultProvider(),
|
||||
}, providers...)
|
||||
}
|
||||
23
backend/services/http.go
Normal file
23
backend/services/http.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"backend/providers/http"
|
||||
|
||||
"git.ipao.vip/rogeecn/atom/container"
|
||||
"git.ipao.vip/rogeecn/atom/contracts"
|
||||
"go.uber.org/dig"
|
||||
)
|
||||
|
||||
type Http struct {
|
||||
dig.In
|
||||
|
||||
Service http.Service
|
||||
Initials []contracts.Initial `group:"initials"`
|
||||
Routes []http.Route `group:"routes"`
|
||||
}
|
||||
|
||||
func Serve() error {
|
||||
return container.Container.Invoke(func(http Http) error {
|
||||
return http.Service.Serve()
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user