From daaf81ae931654e20f882fbc6bbc4a02cbfc0273 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 28 Jul 2024 20:09:09 +0900 Subject: feat(backend): partially implement gaming --- backend/main.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'backend/main.go') diff --git a/backend/main.go b/backend/main.go index 8042674..91caa73 100644 --- a/backend/main.go +++ b/backend/main.go @@ -64,20 +64,22 @@ func main() { api.NewJWTMiddleware(), })) - gameHubs := game.NewGameHubs() - err = gameHubs.RestoreFromDB(ctx, queries) + gameHubs := game.NewGameHubs(queries) + err = gameHubs.RestoreFromDB(ctx) if err != nil { log.Fatalf("Error restoring game hubs from db %v", err) } defer gameHubs.Close() sockGroup := e.Group("/sock") sockHandler := gameHubs.SockHandler() - sockGroup.GET("/golf/:gameId/watch", func(c echo.Context) error { - return sockHandler.HandleSockGolfWatch(c) - }) sockGroup.GET("/golf/:gameId/play", func(c echo.Context) error { return sockHandler.HandleSockGolfPlay(c) }) + sockGroup.GET("/golf/:gameId/watch", func(c echo.Context) error { + return sockHandler.HandleSockGolfWatch(c) + }) + + gameHubs.Run() if err := e.Start(":80"); err != http.ErrServerClosed { log.Fatal(err) -- cgit v1.2.3-70-g09d2