July 2019
Beginner to intermediate
302 pages
9h 38m
English
As always, start with changes to the application's configuration in my_app/__init__.py, which will look something like the following lines of code:
from flask_restful import Api api = Api(app)
Here, app is our Flask application object/instance.
Next, create the API inside the views.py file. Here, we will just try to understand how to lay out the skeleton of the API. Actual methods and handlers will be covered in the Creating a complete RESTful API recipe:
from flask_restful import Resource from my_app import api class ProductApi(Resource): def get(self, id=None): # Return product data return 'This is a GET response' def post(self): # Create a new product return 'This is a POST response' def put(self, id): # Update the product ...