Before starting development or usage of the API, ensure you have all of the prerequiste software installed below.
After installing both Docker and Golang, you are ready to begin.
Clone the repository to your local development environment using:
# HTTPS
git clone https://github.com/uwpokerclub/api.git
# SSH
git clone git@github.com:uwpokerclub/api.git
# GH CLI
gh repo clone uwpokerclub/api
# Change into project directory
cd api
After cloning the repository, you will now need to build the container image with Docker Compose.
docker-compose build
This will build the image to run the API server in.
To start the server, simply start the container using Docker Compose.
docker-compose up -d
This will start both the API server, and a PostgreSQL database along side.
To create a new migration, run the following command.
docker-compose exec server ./scripts/migrate.sh create add_column_to_database sql
To run the most recent migrations, you can run the command
docker-compose exec server ./scripts/migrate.sh up
This will run the migrations for the development database. To run migrations on the test database:
docker-compose exec server ./scripts/migrate.sh --test up
To view all possible migration options, you can list them by not specifying an option.
docker-compose exec server ./scripts/migrate.sh
To run the entire unit test suite, use:
docker-compose exec server go test ./internal/... -v -p=1
Ensure that -p=1
is set. This disables parallelization of the tests. This is crucial since the database is wiped after every test run.
If you only want to run a subset of the test suite, you can use the --run
option and specify text that matches a test name. For example:
docker-compose exec server go test ./internal/... -v -p=1 --run MembershipService
This will only run the membership service test suite.
TBD
The UWPSC Admin API is licensed under the terms of the Apache 2.0 License and can be found here.