Restructure project

This commit is contained in:
Florian Hoss 2023-07-04 23:07:23 +02:00
parent e44e7caa11
commit 16b2f17301
46 changed files with 1744 additions and 1265 deletions

View file

@ -0,0 +1,30 @@
package main
import (
"fmt"
"log"
"net/http"
"gitlab.unjx.de/flohoss/cafe-plaetschwiesle/internal/controller"
"gitlab.unjx.de/flohoss/cafe-plaetschwiesle/internal/env"
"gitlab.unjx.de/flohoss/cafe-plaetschwiesle/internal/logging"
"gitlab.unjx.de/flohoss/cafe-plaetschwiesle/internal/router"
"go.uber.org/zap"
)
func main() {
env, err := env.Parse()
if err != nil {
log.Fatal(err)
}
zap.ReplaceGlobals(logging.CreateLogger(env.LogLevel))
r := router.InitRouter()
c := controller.NewController(env)
router.SetupRoutes(r, c, env)
zap.L().Info("starting server", zap.String("url", fmt.Sprintf("http://localhost:%d", env.Port)), zap.String("version", env.Version))
if err := r.Start(fmt.Sprintf(":%d", env.Port)); err != http.ErrServerClosed {
zap.L().Fatal("cannot start server", zap.Error(err))
}
}