Git Product home page Git Product logo

practice-api's Introduction

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.

practice-api's People

Contributors

martin-plessy avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.