Skip to content

Latest commit

 

History

History
107 lines (73 loc) · 2.9 KB

README.md

File metadata and controls

107 lines (73 loc) · 2.9 KB

API

Getting Started

  1. Install dependencies

  2. If you're using Visual Studio Code press F5 to run the API. Otherwise you can use

dotnet run
  1. 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.

Important Links

Setup Database

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

Run using docker

To run the api using docker the following steps are required.

  1. Create a new docker image from the code

    docker build . -t ghcr.io/agile-waterfall/flooq-api
  2. 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.

  3. 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 the flooq-network.

  4. Visit http://localhost:8080 to verify that the container is running.

Environment

### Variables

  • DB_URL
  • DB_PORT
  • DB_USER
  • DB_PASSWORD
  • API_TOKEN_EXECUTOR
  • API_TOKEN_EDITOR