Git Product home page Git Product logo

devtool-flask-api-generator's Introduction

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

devtool-flask-api-generator's People

Contributors

app-generator avatar mchoopani avatar sajjadkiani avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

devtool-flask-api-generator's Issues

API - Usage in POSTMAN

  • The testing POSTMAN collection should be saved in the media directory
  • Full info usage on README

Project Status & Quality Check

This is used to track the overall progress of the project.

Quality Check

  • The new features are added using isolated assets
  • The new assets are saved in /static/assets/ using suggestive names
  • The JS code should be 100% Vanilla JS
  • No deprecated or jQuery-related dependencies.

API Generator SPECS

  • REQ_01 - Models defined in apps/models.py

    • NOTE: Models should be migrated in the database
  • REQ_02 - User runs the command flask run gen_api - Operation Checks:

    • REQ_02_1 - model exists in the DB
    • REQ_02_2 - model enabled in the CONFIG
  • REQ_03 - The code is generated in apps/api

    • REQ_03_1 - Old code is removed
    • REQ_03_2 - New definitions are added
  • REQ_04 - API Engine:

    • Flask-RestX
  • REQ_04 - API Permissions:

    • REQ_04_1 - Mutating requests -> authenticated users
    • REQ_04_2 - GET requests -> public access

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.