Create a REST endpoint with Python Flask Restful and have a working UI component enabling CRUD functionality in minutes!
- python (3.7.2) -> (Required) Python is required for this project
- pip (20.0.2) -> (Required) Pip is required to install python dependencies
- flask -> The outlining REST framework to run our server.
pip install flask-restful
- pyenv -> (recommended) pyenv is recommended to manage your python versions and package dependencies.
- pyenv-virtualenv -> (recommended) pyenv-virtualenv is recommended to keep your python (pyenv) package dependencies from leaking out.
- Flask -> https://palletsprojects.com/p/flask/
- API Quickstart -> https://flask-restful.readthedocs.io/en/latest/quickstart.html#
You'll find the user guide and all documentation here
-
Set python version to 3.7.2
pyenv global 3.7.2
to set the global python version -
Install flask with your python version
pip install flask-restful
-
Setup project with
python setup.py develop
-
Run project
python api.py
and go to localhost:5050
The root UI is at http://localhost:5000/ and that file is templates/zinggrid.html
The TODO List API urls are:
- GET http://localhost:5000/todos
- POST http://localhost:5000/todos
- PUT http://localhost:5000/todos/:todo_id
- PATCH http://localhost:5000/todos/:todo_id
- GET http://localhost:5000/todos/:todo_id
- DELETE http://localhost:5000/todos/:todo_id
The TODO List API urls are: