- Clone the repository.
- Open the application.properties file from
/src/main/resources/application.properties
. - Add the name of your database here (add username and password, if necessary).
spring.datasource.url=jdbc:postgresql://localhost:5432/{yourDatabaseName}
. - Run and Play it using any API client (e.g., Postman).
- Enjoy!
- Player sends API a move to play using
POST
request to the http://localhost:8080/rps/play/ endpoint in the following format with one of the possible legal moves (i.e., rock, paper, scissors, lizard, spock).
{
"name": "Ponky",
"move": "rock"
}
- The game engine chooses a move in reaction to player's choice and the player receives a game result in a following format.
{
"moves": [
{
"name": "Ponky",
"move": "rock"
},
{
"name": "Bot",
"move": "lizard"
}
],
"result": "Ponky wins"
}
As the game results are stored in the PostgreSQL, they can be accessed anytime using GET
request to the http://localhost:8080/rps/result/ endpoint.
- Unit Testing: Game Logic (e.g., MatchShouldDraw and PaperWinsAgainstRock).
- Postman for API testing.
- Routes should work! - test controller and urls - make custom http client and try to hit the API endpoints with proper and improper data.
- Make tests to check request body in proper JSON format.
- Make dummy json body to check if JSON is valid or not.
- Is the player move legal?