Skip to content

flo-hauser/recipe-collection-api

Repository files navigation

Recipe Server

This is the RESTful backend service used by the recipe collection web app.

Description

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

Setup in local development

  1. Create a Python virtual Enviroment

    python3 -m venv ./venv
  2. Enviroment File .env in project root containing

    SECRET_KEY=a-very-sercret-string
    SECURITY_PASSWORD_SALT=random-string-for-salt
  3. Export additional enviroment variables or use a .flaskenv file

    FLASK_APP=recipe_server.py
    FLASK_DEBUG=true
  4. Activate venv and install requirements

    source venv/bin/activate
    
    pip3 install -r reqirements.txt
  5. Start Flask app

    flask run

Testing

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

OpenAPI documentation

TODO

The REST API ist documented in a OpenAPI document.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published