http server

This commit is contained in:
nquidox 2025-10-25 17:41:19 +03:00
parent a995f4c75a
commit efd0924c60
2 changed files with 35 additions and 4 deletions

View file

@ -7,15 +7,18 @@ import (
"imageStorage/config"
"imageStorage/internal/app"
"imageStorage/internal/convert"
"imageStorage/internal/httpDelivery"
"imageStorage/internal/mainHandler"
"imageStorage/internal/router"
"imageStorage/internal/utils"
"os"
"os/signal"
"syscall"
)
func main() {
//c := config.NewConfig()
c := config.DevConfig()
c := config.NewConfig()
//c := config.DevConfig()
config.LogSetup(c.App.LogLevel)
log.Infof("Log level: %s", c.App.LogLevel)
@ -27,14 +30,25 @@ func main() {
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer cancel()
u := utils.NewHandler(c.App.Domain, c.App.Volume)
r := router.SetRouter("debug")
mainRoute := r.Group("/")
delivery := httpDelivery.NewHandler(u)
delivery.RegisterRoutes(mainRoute)
converter := convert.NewHandler()
imageServerHandler := mainHandler.NewHandler(mainHandler.Deps{
Converter: converter,
Volume: c.App.Volume,
Utils: u,
})
a := app.NewApp(app.Deps{
Config: c,
GrpcServer: imageServerHandler,
HttpServer: r,
})
if err := a.Start(ctx); err != nil {