/api-server-flask-pro

Flask API Server - FlaskRestX / SQLite / MongoDB | AppSeed

OtherNOASSERTION

Flask API Server PRO

Flask Starter with JWT authentication, and SQLite persistance - Provided by AppSeed App Generator. It has all the ready-to-use bare minimum essentials.


Features:

  • API Definition - the unified API structure implemented by this server
  • Simple JWT API powered by flask-restx and flask_jwt_extended
  • Authentication with JWT (JWT login, JWT logout, Register)
  • Branches:
    • Master: SQLite Persistence
    • Mongo: MongoDB Persistence
  • Unitary tests, Docker

Can be used with other UI projects for a complete fullstack experience


Support:

  • Github (issues tracker), Email: support @ appseed.us
  • Discord: LIVE Support (registered AppSeed Users)

Flask API Server - Open-source Flask Starter provided by AppSeed.


Table of Contents

  1. Getting Started
  2. Project Structure
  3. Modules
  4. Testing

Getting Started

clone the project (private repository)

$ git clone https://github.com/app-generator/priv-api-server-flask-pro.git
$ cd priv-api-server-flask-pro

create virtual environment using python3 and activate it (keep it outside our project directory)

$ python3 -m venv /path/to/your/virtual/environment
$ source <path/to/venv>/bin/activate

install dependencies in virtualenv

$ pip install -r requirements.txt

setup flask command for our app

$ export FLASK_APP=run.py
$ export FLASK_ENV=development

Or for Windows-based systems

$ (Windows CMD) set FLASK_APP=run.py
$ (Windows CMD) set FLASK_ENV=development
$
$ (Powershell) $env:FLASK_APP = ".\run.py"
$ (Powershell) $env:FLASK_ENV = "development"

start test APIs server at localhost:5000

$ python run.py

or

$ flask run

use flask-restx' swagger dashboard to test APIs, or use POSTMAN

Project Structure

api-server-flask/
├── api
│   ├── config.py
│   ├── __init__.py
│   ├── models.py
│   └── routes.py
├── Dockerfile
├── README.md
├── requirements.txt
├── run.py
└── tests.py

Docker

Our docker image details are in Dockerfile

To build the docker image (replace app name between < > as per your requirment)

$ docker build -t <api-server-flask-app>:latest .

To run the docker container

$ docker run -d -p 5000:5000 <api-server-flask-app>

Modules

This application uses the following modules

  • Flask==1.1.4
  • flask-restx==0.4.0
  • Flask-JWT-Extended
  • pytest

Testing

Run tests using pytest tests.py



Flask API Server - provided by AppSeed App Generator