Code Monkey home page Code Monkey logo

flask-api-sample's Introduction

Flask API Sample

Simple Flask API Server powered by Flask-RestX, SqlAlchemy, SQLite persistence - Provided by AppSeed.


Features:

  • Up-to-date dependencies
  • Simple, intuitive codebase - can be extended with ease.
  • Flask-restX
  • Docker support
  • Free support via email and Discord (1k+ community).

✨ API Definition

Route Verb Info Status
/datas GET return all items ✔️
POST create a new item ✔️
/datas:id GET return one item ✔️
PUT update item ✔️
DELETE delete item ✔️

✨ Quick Start in Docker

Get the code

$ git clone https://github.com/app-generator/flask-api-sample.git
$ cd flask-api-sample

Start the app in Docker

$ docker-compose up --build  

The API server will start using the PORT 5000.


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


✨ How to use the code

Step #1 - Clone the project

$ git clone https://github.com/app-generator/flask-api-sample.git
$ cd flask-api-sample

Step #2 - create virtual environment using python3 and activate it (keep it outside our project directory)

$ # Virtualenv modules installation (Unix based systems)
$ virtualenv env
$ source env/bin/activate
$
$ # Virtualenv modules installation (Windows based systems)
$ # virtualenv env
$ # .\env\Scripts\activate

Step #3 - Install dependencies in virtualenv

$ pip install -r requirements.txt

Step #4 - 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"

Step #5 - start test APIs server at localhost:5000

$ flask run

Use the API via POSTMAN or Swagger Dashboard.

Flask API Sample - Swagger Dashboard.


✨ Project Structure

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


Flask API Sample - provided by AppSeed App Generator

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.