-
Install dependencies
-
If you're using Visual Studio Code press F5 to run the API. Otherwise you can use
dotnet run
- Run the tests with
dotnet test
Open https://localhost:7035/ with your browser to see the result. The current API definitions are accessible via the Swagger UI.
The easiest way to install the DB is by running an instance in a local docker container, however if you already have a DB instance this is not necessary.
To setup the container simply run:
docker network create flooq-network
This creates a new network so other containers can access the database if they're in the same network.
docker run -d --name FlooqDatabase --network=flooq-network -v my_dbdata:/var/lib/postgresql/data -p 54320:5432 -e POSTGRES_PASSWORD=test123 postgres:13
And then to create a new database use:
docker exec -it FlooqDatabase psql -U postgres -c "create database FlooqDatabase"
To apply the current database scheme you have to use the Entity Framework tools these can be installed via:
dotnet tool install --global dotnet-ef
After that update the database like so:
dotnet ef database update
To run the api using docker the following steps are required.
-
Create a new docker image from the code
docker build . -t ghcr.io/agile-waterfall/flooq-api
-
Create a network if you don't have setup one already.
docker network create flooq-network
This network allows docker containers to talk to one another.
-
Run the docker container you just build.
docker run \ -d -p 8080:80 \ --name flooq-api \ --network=flooq-network \ --env ConnectionStrings:FlooqDatabase=<YOUR_CS> \ ghcr.io/agile-waterfall/flooq-api
This runs the docker container and exposes the port
8080
. The container is now in theflooq-network
. -
Visit
http://localhost:8080
to verify that the container is running.
### Variables
DB_URL
DB_PORT
DB_USER
DB_PASSWORD
API_TOKEN_EXECUTOR
API_TOKEN_EDITOR