/scores-api

The backend for scoring gamers accross levels on top of custom REST implementation

Primary LanguageJava

Scores API

The backend which registers game scores for different users at different levels, with the capability to return high score lists per level. There also simple login system to authorize users.

The system is built from scratch using sockets and Java NIO Non-blocking API to implement custom REST layer. To dispatch and handle request concurrently the Reactor pattern has been used.

Endpoints

Path Method Response Details
/login POST 200 Generates a new session key to authenticate an user. The key is valid for 10 minutes.
/levels/{level}/users/{name} POST 200/401/400 Posts a user's score to a level. Requires session key to be included in Authorization header. Similar the score should be present in the body.
/levels/{level}/scores GET 200 Returns a high score list for a level.

Build and run instructions

  • build
./mvnw clean install
  • run JAR
cd code/score-api-daemon/target/
java -jar score-api-daemon-1.0.jar
  • run and stop Docker image
cd code/score-api-daemon/
docker-compose up -d
docker ps
docker-compose stop