Skip to content

Microservice component designed to provide a chess-playing API

Notifications You must be signed in to change notification settings

bilskik/GameLogicService

 
 

Repository files navigation

GameLogicService

Microservice component designed to provide a chess-playing API.

Tech Stack:

  • Java 17
  • Spring Boot 3.2.2
  • Spring Security 6.2.1
  • Spring Aop
  • Spring Data Jpa
  • Spring Boot Validation
  • Lombok
  • ModelMapper
  • Feign Client
  • Web Sockets (Stomp) API
  • Gradle
  • Redis
  • chesslib

API

Http

  • POST /game-init - to initialize game
{
    "gameMode" : "<string>",
    "gameTime" : "<string>",
    "player1PieceColor" : "<string>",
    "player1" : "<string>",
    "player2" : "<string>"
}
{
  "gameCode" : "<string>"
}
  • GET /game-info/{gameCode} - get info about game
{
    "fen" : "<string>",
    "whiteTime" : "<string>",
    "blackTime" : "<string>",
    "sideToMove" : "<string>",
    "gameStatus" : "<string>",
    "playerColor" : "<string>"
}

WebSocket

  • /game-handshake - enable websocket connection

Example (written in JavaScript):

  client = new StompJs.Client({
    brokerURL: "ws://localhost:8000/game-handshake",
    connectHeaders: {
        token: jwtToken,
        gameCode : gameCode
    }
  })
  • MESSAGE /queue/move/${gameCode} - for receiving game-message:
{
  "move" : "<string>",
  "fen" : "<string>",
  "time" : "<string>",
  "nextMoveSide" : "<string>",
  "gameStatus" : "<string>",
  "errorMessage" : "<null> | <string>"
}
  • SEND /game/move - for sending messages

Payload:

  {
    "gameCode": "<string>",
    "move": "<string>"
  }

About

Microservice component designed to provide a chess-playing API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 95.3%
  • HTML 4.4%
  • Dockerfile 0.3%