Initial
This commit is contained in:
commit
995ea60f34
11 changed files with 449 additions and 0 deletions
42
cmd/main.go
Normal file
42
cmd/main.go
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"merch-parser-api/config"
|
||||
"merch-parser-api/internal/app"
|
||||
"merch-parser-api/internal/router"
|
||||
"merch-parser-api/pkg/db"
|
||||
)
|
||||
|
||||
func main() {
|
||||
//setup config
|
||||
//c := config.NewConfig()
|
||||
c := config.DevConfig()
|
||||
ctx := context.Background()
|
||||
|
||||
database, err := db.Connection(c)
|
||||
if err != nil {
|
||||
log.WithError(err).Fatal("Main | Error connecting to database")
|
||||
}
|
||||
|
||||
_ = database
|
||||
|
||||
routerHandler := router.NewRouter(router.Deps{
|
||||
ApiPrefix: c.AppConf.ApiPrefix,
|
||||
GinMode: c.AppConf.GinMode,
|
||||
})
|
||||
|
||||
//keep last
|
||||
appl := app.NewApp(app.Deps{
|
||||
Host: c.AppConf.Host,
|
||||
Port: c.AppConf.Port,
|
||||
Router: routerHandler,
|
||||
})
|
||||
|
||||
err = appl.Run(ctx)
|
||||
if err != nil {
|
||||
log.WithError(err).Fatal("Main | Error starting app")
|
||||
return
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue