This is the RESTful backend service used by the recipe collection web app.
This Service is suppoed to be used as a REST Api for my recipe collection web app. It features it's own user and session managment as well as the domains techincal data. Most ressources impement a basic CRUD interface.
The Service is build upon Flask using ideas from The Flask Mega-Tutorial.
The User Authentication via basic-auth and tokens ist based upon Flask-HTTPAuth
-
Create a Python virtual Enviroment
python3 -m venv ./venv
-
Enviroment File
.env
in project root containingSECRET_KEY=a-very-sercret-string SECURITY_PASSWORD_SALT=random-string-for-salt
-
Export additional enviroment variables or use a
.flaskenv
fileFLASK_APP=recipe_server.py FLASK_DEBUG=true
-
Activate venv and install requirements
source venv/bin/activate pip3 install -r reqirements.txt
-
Start Flask app
flask run
Tests are executed with pytest
test runner and are located in ./tests
.
By default there are a few Users in a in-memory sqlite database, i.e. one admin user, id:1
, and four unique users with the user role.
pytest
Coverage and coverage reports are made with Coverage.py. E.g.:
coverage run -m pytest && coverage report
Usage in CI/CD with quality gates (here 90% overall):
coverage run -m pytest
coverage report --fail-under=90
TODO
The REST API ist documented in a OpenAPI document.