A simple chess app with some basic APIs.
- Clone the ChessAPI repository from GitHub using the following command:
git clone https://github.com/banty306/ChessAPI.git
- Change the working directory to the ChessAPI folder:
cd ChessAPI
- Run the Docker containers using docker-compose:
docker-compose up -d or sudo docker-compose up
Please do verify by now the containers should be up and running.
curl --location 'localhost:8000/api/v1/chess/queen' \
--header 'Content-Type: application/json' \
--header 'Cookie: csrftoken=0zkaYrpXdhPw5Hdlg6OXwGUJv1TCOhOF3wGsu2wTasooKsQkIEhQIh2j7DbR9EGz' \
--data '{"positions": {"Queen": "H1", "Bishop": "B7", "Rook":"H8", "Knight": "F2"}}'
Response
{
"valid moves": [
"B7",
"G1",
"F1",
"E1",
"C1",
"B1",
"A1",
"H8"
]
}
curl --location 'localhost:8000/api/v1/chess/knight' \
--header 'Content-Type: application/json' \
--header 'Cookie: csrftoken=0zkaYrpXdhPw5Hdlg6OXwGUJv1TCOhOF3wGsu2wTasooKsQkIEhQIh2j7DbR9EGz' \
--data '{"positions": {"Queen": "E7", "Bishop": "B7", "Rook":"G5", "Knight": "C3"}}'
Response
{
"valid moves": [
"A2",
"A4",
"B1",
"D1"
]
}
curl --location 'localhost:8000/api/v1/chess/rook' \
--header 'Content-Type: application/json' \
--header 'Cookie: csrftoken=0zkaYrpXdhPw5Hdlg6OXwGUJv1TCOhOF3wGsu2wTasooKsQkIEhQIh2j7DbR9EGz' \
--data '{"positions": {"Queen": "A5", "Bishop": "G8", "Rook":"H5", "Knight": "G4"}}'
Response
{
"valid moves": [
"A5",
"H4",
"H3",
"H1",
"H8"
]
}
curl --location 'localhost:8000/api/v1/chess/bishop' \
--header 'Content-Type: application/json' \
--header 'Cookie: csrftoken=0zkaYrpXdhPw5Hdlg6OXwGUJv1TCOhOF3wGsu2wTasooKsQkIEhQIh2j7DbR9EGz' \
--data '{"positions": {"Queen": "H3", "Bishop": "B2", "Rook":"H8", "Knight": "F2"}}'
Response
{
"valid moves": [
"A1",
"C1",
"D4",
"E5",
"F6",
"G7"
]
}