43 lines
795 B
Go
43 lines
795 B
Go
|
|
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
|
||
|
|
}
|
||
|
|
}
|