TODO Visit #10 to see Progress
To use the latest release for local testing run the following steps. dotnet doesn't need to be installed on your local computer.
Prerequisites
- Docker is installed & running
Setup
- Open command-line and navigate to the root of the repository
- run
docker-compose up
- Access the API from your browser http://localhost:5023/playground
If you have done some work on the code you probably want to check if your changes break the build or the tests. This can be done locally.
Prerequisites
- dotnet core 2.1 SDK installed. (for specific version see global.json)
This solution works on all operation systems on which you can run dotnet core.
Prerequisites
- Cake Tool installed(min. Version 0.33.0). To install run
dotnet tool install -g Cake.Tool
Build and Test the Api
- Open command-line and navigate to the root of the repository
- run
dotnet cake build.cake
Now the entire solution is built and the tests are executed.
This solution does not require Cake.Tool to be installed on your system but it only works on Windows.
Build and Test the Api
- Open command-line and navigate to the root of the repository
- run
.\build.ps1
Now the entire solution is built and the tests are executed.
- Open command-line and navigate to the root of the repository
- Open
/src/Api/appsettings.json
and verify thatDatabase:ConnectionString
has a valid Connectionstring for a MongoDB according to your system setup - run
cd ./src/Api; dotnet watch run
After you finished developing you probably want to check if the changes behave correctly in the container environment. Therefore you can build the docker image locally.
- Open command-line and navigate to the root of the repository
- run
.\build.ps1 -target "PublishApi"
with Powershell ordotnet cake --target=PublishApi
using the cake tool. This build the Api in Release Mode - run
docker build -t ultimatettt/ultimate-ttt-server:localtesting
. this creates a local image of the previously built api. - run
docker-compose -f "docker-compose-localtesting.yml" up
. This starts the local testing image.
mutation CreateNewGame{
createGame{
id
}
}
mutation Move{
move(
input: {
gameId: "abcdef"
boardPosition: {x: 0, y:0}
tilePosition: {x: 0, y:0}
player:CROSS
}
){
isValid
}
}
query GameStatus{
game(id: "abcdef"){
id
moves{
moveNumber
boardPosition{
x
y
}
tilePosition{
x
y
}
player
}
winner
}
}
In order to get notified of the opponents moves you have to specify 2 things.
gameId: The Id of the game you are playing
player: The player of which you want to receive the moves
subscription onOpponentMoved {
onMove(gameId: "AAYfPSa", player: CROSS) {
moveNumber
boardPosition{
x
y
}
tilePosition{
x
y
}
player
}
}