init project

This commit is contained in:
yanghao05
2023-01-28 11:09:11 +08:00
parent 11a561bdd7
commit 114c003b2b
38 changed files with 2011 additions and 0 deletions

31
services/http/http.go Normal file
View File

@@ -0,0 +1,31 @@
package http
import (
_ "app/modules"
"app/contracts"
"app/providers/config"
"app/providers/http"
"app/providers/logger"
"go.uber.org/dig"
)
type Http struct {
dig.In
Logger *logger.Logger
Conf *config.Config
Service *http.Service
Routes []contracts.Route `group:"route"`
}
func Serve(http Http) error {
http.Logger.Infof("http service port %s", http.Conf.Http.Address())
for _, route := range http.Routes {
route.Register()
}
http.Logger.Infof("starting server on %s", http.Conf.Http.Address())
return http.Service.Serve()
}