diff --git a/api/handler/handler.go b/api/handler/handler.go index 6615f86..6c661e0 100644 --- a/api/handler/handler.go +++ b/api/handler/handler.go @@ -126,3 +126,9 @@ func JoinPrivateGame(c *gin.Context) { c.Header("Access-Control-Allow-Origin", "*") c.IndentedJSON(http.StatusOK, info) } + +func JoinGame(c *gin.Context) { + gameID := c.Param("id") + log.Println(gameID) + c.JSON(http.StatusOK, gameID) +} diff --git a/api/websocket/connection.go b/api/websocket/connection.go index be29d8c..464303c 100644 --- a/api/websocket/connection.go +++ b/api/websocket/connection.go @@ -70,3 +70,7 @@ func waitForAndHandlePlayerID(ctx context.Context, conn *gorillaws.Conn) { lobby.Game.SetWebsocketConnectionFor(ctx, player, conn) log.Println("player after setting connection: ", player) } + +func ConnectWsForGame(c *gin.Context) { + +} diff --git a/main.go b/main.go index 9cee4de..3d5837c 100644 --- a/main.go +++ b/main.go @@ -28,7 +28,10 @@ func main() { router.GET("/api/hostPrivate", handler.HostPrivateGameHandler) router.POST("/api/joinPrivate", handler.JoinPrivateGame) router.GET("/api/ws", websocket.RegisterWebSocketConnection) + router.GET("/api/getLobbyForPassphrase/:phrase", handler.GetLobbyForPassphraseHandler) + router.GET("/api/registerWsForGame/:id", websocket.ConnectWsForGame) + router.POST("/api/joinGame/:id", handler.JoinGame) if debugMode { log.Println("Starting service WITHOUT TLS")