We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a85be4e commit 033329aCopy full SHA for 033329a
app/routes.py
@@ -765,11 +765,18 @@ def get_all_products():
765
tags:
766
- Product
767
description: Get all products.
768
+ parameters:
769
+ - in: query
770
+ name: page
771
+ type: integer
772
+ default: 1
773
+ description: Page number
774
responses:
775
200:
- description: A list of products.
776
+ description: A list of products for that page.
777
"""
- products = Product.query.order_by(Product.name).all()
778
+ page = request.args.get("page", default=1, type=int)
779
+ products = Product.query.order_by(Product.id.asc()).paginate(page=page, per_page=2, error_out=False)
780
return jsonify({"products": [product.to_json() for product in products]}), 200
781
782
0 commit comments