This is a repository for test/training purposes
- The goal is to fork the repo in your account and create a pull request from a branch with the format
api-exercises-<YOUR_NAME>(https://akrabat.com/the-beginners-guide-to-contributing-to-a-github-project/) check the git note at the end of the README file - Install Docker and Docker-Compose following the link below
- Run from inside the project folder
docker-compose up --build - Create an api with the flask microframework with the entrypoint being at
api/main.py - Connect with postgres with the following URI
postgresql://postgres:postgres@localhost:5430/wine
The easiest way to run docker is a linux environment (preferably ubuntu)
1. '/api/getMaxFixedAcidicity'
2. '/api/getNeutralWines' -> neutral is the ph range between 6-8
3. '/api/getTopAlcoholWines' -> 10 most alcoholic wines
4. '/api/getBottomDensityWines -> 10 least density wines
1. '/api/addWine' -> post, insert one or more new wines
2. '/api/editWine' -> post, update an existing wine
3. '/api/removeWine' -> post, remove a wine
You DON'T have to create any table or database. Just run and connect to the database given, create:
- the models (https://flask-sqlalchemy.palletsprojects.com/en/2.x/models/),
- the recources (https://flask-restful.readthedocs.io/en/latest/quickstart.html)
needed for the exercise
Sqlalchemy works on top of a python driver for the respective database. For the PostgreSQL you need a python driver to be installed in your python environment. The most popular is the psycopg2
In the folder exercises you will find 2 files exercises.py and exercises.js.
Inside these files there are standalone exercises for you to solve in python and javascript respectivelly
In case you are not comfortable using git, skip the first step of the guideline, just download the code and send as an email with your zip file containing the solutions. We strongly suggest to use the git process though.
Enjoy!