TP_JO2024/PROJET.md
2024-03-27 15:20:10 +01:00

1.4 KiB

API JO 2024

Todo :

  • API Athletes (in progress), API Medaille, API Discipline
  • Simple FrontEnd
  • Dockerize
  • Data generation script for testing purpose

Done :

  • Swagger definitions
  • Base model (on Athletes) with unitests (pytest)

Architecture

3 uServices in their respective subfolders:

  • /athlete: Athletes API
  • /medaille: Medals API
  • /discipline: Disciplines API

A swagger.yaml definition is available in each uService definition in the api folder.

The data folder contains the data used by the API in dev. It is a shared folder in the dev environement. The sample folder for default values inside the containers. It should be mounted in the docker container in seperated volumes as they shouldn't talk to each other.

How to run (dev)

Go in the right API folder. Start the flask application

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cd athlete/
python app.py

How to test

pytest -v athlete/tests
pytest -v discipline/tests
pytest -v medaille/tests

How to build the docker images

You can build using the rootfolder context and the Dockerfile in the subfolder.

docker build . -f athlete/Dockerfile
docker build . -f discipline/Dockerfile
docker build . -f medaille/Dockerfile

However, the compose file is already set up to build the images for you.

docker compose up -d