added: app modules register
This commit is contained in:
parent
5ffb6dde46
commit
7e5010ac78
5 changed files with 85 additions and 7 deletions
42
cmd/main.go
42
cmd/main.go
|
|
@ -4,11 +4,22 @@ import (
|
|||
"context"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"merch-parser-api/config"
|
||||
_ "merch-parser-api/docs" //for swagger
|
||||
"merch-parser-api/internal/api/user"
|
||||
"merch-parser-api/internal/app"
|
||||
"merch-parser-api/internal/interfaces"
|
||||
"merch-parser-api/internal/router"
|
||||
"merch-parser-api/pkg/db"
|
||||
"merch-parser-api/pkg/utils"
|
||||
)
|
||||
|
||||
// @Title Merch Parser
|
||||
// @BasePath /api/v2
|
||||
// @Version 2.0.0-alpha
|
||||
// @SecurityDefinitions.apikey BearerAuth
|
||||
// @In header
|
||||
// @Name Authorization
|
||||
// @Description Введите "Bearer {your_token}" для аутентификации
|
||||
func main() {
|
||||
//setup config
|
||||
//c := config.NewConfig()
|
||||
|
|
@ -27,11 +38,36 @@ func main() {
|
|||
GinMode: c.AppConf.GinMode,
|
||||
})
|
||||
|
||||
//base providers
|
||||
//jwtProv := token.NewJWT(token.Deps{
|
||||
// SecretKey: c.JWTConf.Secret,
|
||||
// Issuer: c.JWTConf.Issuer,
|
||||
// AccessExpire: c.JWTConf.AccessExpire,
|
||||
// RefreshExpire: c.JWTConf.RefreshExpire,
|
||||
//})
|
||||
|
||||
utilsProv := utils.NewUtils()
|
||||
|
||||
//deps providers
|
||||
|
||||
//register app modules
|
||||
users := user.NewHandler(user.Deps{
|
||||
DB: database,
|
||||
Utils: utilsProv,
|
||||
})
|
||||
|
||||
//collect modules
|
||||
modules := []interfaces.Module{
|
||||
users,
|
||||
}
|
||||
|
||||
//keep last
|
||||
appl := app.NewApp(app.Deps{
|
||||
Host: c.AppConf.Host,
|
||||
Port: c.AppConf.Port,
|
||||
Router: routerHandler,
|
||||
Host: c.AppConf.Host,
|
||||
Port: c.AppConf.Port,
|
||||
ApiPrefix: c.AppConf.ApiPrefix,
|
||||
RouterHandler: routerHandler,
|
||||
Modules: modules,
|
||||
})
|
||||
|
||||
err = appl.Run(ctx)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue