Postman Collection Documentation: https://documenter.getpostman.com/view/30303534/2s9YeD8YTz
- Scala
- SBT (Scala Build Tool)
- Docker and Docker Compose
- Clone the repository:
git clone https://github.com/Kaushal1011/CS441GraphCatchMeRest.git
- Navigate to the project directory:
cd CS441GraphCatchMeRest
- Compile and run the application:
sbt clean compile run
This will start the application on port 8080.
- Build the Docker image:
docker compose up --build
- Start the application using Docker Compose:
This will start both the application on port 80 and Nginx as a reverse proxy.
docker compose up
- Action (
/action
): POST request to perform an action (move police or thief). This endpoint is used by the players to move their respective agent. - Initialize Game (
/init
): POST request to initialize the game environment. Initializes the game with the given graph files. Requires Auth. - Reset Game (
/reset
): POST request to reset the game environment. Requires Auth. This endpoint is used to reset the game environment. - Query Graph (
/querygraph
): GET request to retrieve the current state of the game graph. This endpoint returns the current url of the graph file. which can be used by agent. - Query Agent (
/queryagent
): POST request to get data about a specific agent (police or thief). This endpoint returns the current position of the agents and the winner if any.
QuickstartApp.scala
-- contains the main method which bootstraps the applicationCatchMeRoutes.scala
-- Akka HTTProutes
defining exposed endpointsCatchMeGameRegistry.scala
-- the actor which handles the requests and keeps the in-memory databaseJsonFormats.scala
-- converts the JSON data from requests into Scala types and from Scala types into JSON responses
CatchMeGameEnvironment.scala
-- contains the methods for the environment of the game as inspired from gym environments
NodeDataParser.scala
-- contains the methods for parsing the data from the nodesLamdaInvoker.scala
-- contains the methods for invoking the lambda functions using protobuf
winner.proto
-- contains the protobuf for the winner request and response
docker-compose.yml
-- Docker Compose configuration filenginx.conf
-- Nginx configuration filebuild.sbt
-- SBT build fileDockerfile
-- Dockerfile for the application
The rest api uses a special flag in config invalid-makes-loss = "false"
the enables disables the losing on invalid move.