Restructure project
This commit is contained in:
parent
e44e7caa11
commit
16b2f17301
46 changed files with 1744 additions and 1265 deletions
30
cmd/cafe-plaetschwiesle/cafe-plaetschwiesle.go
Normal file
30
cmd/cafe-plaetschwiesle/cafe-plaetschwiesle.go
Normal 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))
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue