Skip to content

A CRUD API to practice Flask and Python.

Notifications You must be signed in to change notification settings

martin-plessy/practice-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A CRUD API to Practice Flask and Python

A CRUD API to practice Flask and Python, which I created before implementing the Full Fibre's technical test, in order to learn the patterns of documenting, implementing and testing a green-field Flask API and forge my own opinion about Flask and its ecosystem.

Project Requirements

The Practice CRUD API uses Python 3.8.

Project Setup

# Virtual environment:
py -m venv .venv
./.venv/Scripts/Activate.ps1

# Installing project dependencies:
pip install -r requirements.txt

# You may also need:
pip install -e .

Run the Tests

# Tests:
pytest

# Tests with coverage:
coverage run -m pytest ; coverage report

Run the App

# Create the database schema:
flask create-db

# Start the development server:
$Env:FLASK_DEBUG = 1 ; flask run

# Fill the database with sample data:
flask fill-db

Resources

Notes

  • I'm still much confused about the Flask-RestFull / Flask-RestPlus / Flask-RestX / Flask-SmoRest struggle...
  • There seems to be a part of the Flask API that isn't documented (e.g. flask.views.MethodView).
  • When adding new API resources, it's better to:
    1. Add it as an independent resource, i.e. without relations/FKs/links.
    2. Test the validation and other features for the basic resource.
    3. Commit.
    4. And only then add the relations to other API resources.

About

A CRUD API to practice Flask and Python.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages