- Having Docker and Docker Compose installed
- To test the APIs you need to seed the database with seeder CLI, because the database is empty.
To start the app in development mode run:
cd PROGECT_DIRECTORY
docker compose up
Info:
- RestAPI: 127.0.0.1:8080
- POSTGRESQL IP: 127.0.0.1:5432
- POSTGRESQL PASSWORD=gHteuivwdvkew4wt
- POSTGRESQL USERNAME=postgres
- POSTGRESQL DATABASE=stunning-couscous
To run tests:
# start the database
docker compose up db
cd PROGECT_DIRECTORY
./test.sh
Build script:
- Creates a ready to use docker image for production
- Creates binary seeder cli
- Creates partnerapi binary file to use
To run the script:
cd PROGECT_DIRECTORY
./build.sh
The seeder CLI generates random partners and writes them to the database. Make sure the database is up and running then run the seeder:
cd PROGECT_DIRECTORY
./cmd/seeder
Postman colletion in the project main directory is provided to use and call the APIs.
- GET /api/partner/:id
example:
curl --location --request GET 'http://127.0.0.1:8080/api/partner/1'
- GET /api/search/partner/best-match
- material e.g. wood
- latitude e.g. 52.49304178513987
- longitude e.g. 13.40497255
- phone e.g. 1123456789
- square e.g. 70
example:
curl --location --request GET 'http://127.0.0.1:8080/api/search/partner/best-match?material=carpet&latitude=52.49304178513987&longitude=13.40497255&phone=1123456789&square=70'