Fun with Flask
I am learning Flask and creating some nice REST API's at home and work. Here is one I recently built for fun.
I am learning Flask and creating some nice REST API's at home and work. Here is one I recently built for fun.

bikesaledemo
A Flask API Bicycle sales API demo code
Intro
Learning about Flask and creating nice REST API's
Reasoning
I like bikes, and I like Python.
Install
I wrote it for Python 3.5, but it may work in Python 2.7 YMMV
git clone https://gitlab.com/abvavgjeremy/bikesaledemo.git
cd bikesaledemo
pip install requirements.txt
python app.py
Open http://127.0.0.1:5000/
in browser of choice.
note: it will be empty on start up
API Resources:
GET A BIKE AND/OR BIKES
- To return all bikes in memory:
curl -X GET http://127.0.0.1:5000/
- To return a specific bike id (i.e. bike1)
curl -X GET http://127.0.0.1:5000/bike1
POST A BIKE
Requires: bicycle, year, color, size, and price
curl -X POST http://127.0.0.1:5000/bike1 -H 'content-type: application/json' -d '{"bicycle": "Trek 930","year": "1995","color": "blue/green","size": "21 inches","price": 549.99}'
PUT UPDATE A BIKE, ALSO CREATE IF NONE EXIST
Requires: bicycle, year, color, size, and price
curl -X PUT http://127.0.0.1:5000/bike1 -H 'content-type: application/json' -d '{"bicycle": "Trek 930","year": "1995","color": "blue/green","size": "21 inches","price": 249.99}'
DELETE A BIKE
curl -X DELETE http://127.0.0.1:5000/bike1
Conclusion
This is just a demo to practice Flask and Flask-restful