aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/main.go
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-08-01 01:19:00 +0900
committernsfisis <nsfisis@gmail.com>2024-08-01 01:19:00 +0900
commitf5b6c2f14d3521e9763ba7a356b8e87ebc6d7cd9 (patch)
treebe7fe2a9b1a66553f7cda5a462afef801b6cf438 /backend/main.go
parent5fc739292bdd65da2d33f1e9a4c2b1b33576fdf6 (diff)
downloadphperkaigi-2025-albatross-f5b6c2f14d3521e9763ba7a356b8e87ebc6d7cd9.tar.gz
phperkaigi-2025-albatross-f5b6c2f14d3521e9763ba7a356b8e87ebc6d7cd9.tar.zst
phperkaigi-2025-albatross-f5b6c2f14d3521e9763ba7a356b8e87ebc6d7cd9.zip
feat: change procedure of game starting
Diffstat (limited to 'backend/main.go')
-rw-r--r--backend/main.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/backend/main.go b/backend/main.go
index d3a180c..d636af7 100644
--- a/backend/main.go
+++ b/backend/main.go
@@ -57,13 +57,6 @@ func main() {
e.Use(middleware.Logger())
e.Use(middleware.Recover())
- apiGroup := e.Group("/api")
- apiGroup.Use(oapimiddleware.OapiRequestValidator(openApiSpec))
- apiHandler := api.NewHandler(queries)
- api.RegisterHandlers(apiGroup, api.NewStrictHandler(apiHandler, []api.StrictMiddlewareFunc{
- api.NewJWTMiddleware(),
- }))
-
gameHubs := game.NewGameHubs(queries)
err = gameHubs.RestoreFromDB(ctx)
if err != nil {
@@ -79,6 +72,13 @@ func main() {
return sockHandler.HandleSockGolfWatch(c)
})
+ apiGroup := e.Group("/api")
+ apiGroup.Use(oapimiddleware.OapiRequestValidator(openApiSpec))
+ apiHandler := api.NewHandler(queries, gameHubs)
+ api.RegisterHandlers(apiGroup, api.NewStrictHandler(apiHandler, []api.StrictMiddlewareFunc{
+ api.NewJWTMiddleware(),
+ }))
+
gameHubs.Run()
if err := e.Start(":80"); err != http.ErrServerClosed {