Skip to content

app-generator/devtool-flask-api-generator

Repository files navigation

Flask API Generator

The tool is able to generate APIs using Flask, Flask-RestX stack with a minimum effort. For newcomers, Flask is a leading backend framework used to code from simple websites and APIs to complex eCommerce solutions.


Video Presentation

flask-soft-dashboard-api-generator.mp4

How It Works

This module helps to generate secure APIs using Flask-restX via a simple workflow:

  • Edit/add your model in apps/models.py
  • Migrate the database:
$ flask db init     # this should be executed only once
$ flask db migrate  # Generates the SQL 
$ flask db upgrade  # Apply changes 
  • Update Configuration:
    • apps/config .py, section API_GENERATOR
  • Generate the API code:
    • $ flask gen_api # the new code is saved in apps/api
  • Access the API in the browser:
    • /api/MODEL_NAME/

The API is secured using the JWT tocken provided by /login/jwt/ request (username & password should be provided).

  • GET requests are public (GET all, get Item)
  • Mutating requests are protected by token generated based on the user credentials (username, pass).

Two POSTMAN Collections are provided in the media directory:

  • Books API - that uses PORT *5000 for the api
  • Books API 2 - that uses PORT *5085 for the api (default port in Docker)

In case both port are unusable in your environment, feel free to edit the files before POSTMAN import.



Flask API Generator - Developer tool provided by AppSeed