Skip to content

Flask-based backend API for a basic e-commerce platform, with models and RESTful API endpoints and MySQL database integration with CRUD operations

Notifications You must be signed in to change notification settings

jagati2/Flask-E-Commerce-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask-E-Commerce-API with MySQL

Files navigation

controllers folder has product_cartitem_controller file this consists of API endpoints.

models folder has cart_item_model and product_model and the respective queries/ functions/ CRUD operations related code is in these files

Download setup

Step-1: Creating & activating venv Windows:

python -m venv venv ./venv/Scripts/activate

Step-2: Installing Dependencies

pip install -r requirements.txt

Step-3: Running application Windows:

$env:PYTHONDONTWRITEBYTECODE=1;$env:FLASK_APP="app";$env:FLASK_ENV = "development"

Step-4: Connect MySQL with the code editor and create database=flask_ecommerce and tables= product and cart_item

Step-5:

flask run

Step-6:

open postman application and paste the link with respective endpoints

Output

product table in mysql

Screenshot 2024-02-23 192056

cart_item table in mysql

Screenshot 2024-02-23 192327

flask run in VS code

Screenshot 2024-02-23 191837

GET /products: Returns a list of all products.

Screenshot 2024-02-23 191815

GET /products/: Returns details of a specific product.

Screenshot 2024-02-23 192125

POST /cart: Adds a product to the cart.

Screenshot 2024-02-23 192417

in mysql its added

Screenshot 2024-02-23 192619

GET /cart: Retrieves the cart items.

Screenshot 2024-02-23 192519

DELETE /cart/: Removes a specific item from the cart.

Screenshot 2024-02-23 192607

in mysql id=2 is deleted

Screenshot 2024-02-23 192619

Additional end points

get specific cart item by id

Screenshot 2024-02-23 194742

adds a product to the table

Screenshot 2024-02-23 195227

in mysql its added

Screenshot 2024-02-23 195240

update the product

Screenshot 2024-02-23 200250

in mysql id=1 is updated

Screenshot 2024-02-23 200259

delete a product by id

Screenshot 2024-02-23 200633

in mysql id=4 is deleted

Screenshot 2024-02-23 200643

get specific cart item by id

Screenshot 2024-02-23 200842

update cart item

Screenshot 2024-02-23 201238 Screenshot 2024-02-23 201251

About

Flask-based backend API for a basic e-commerce platform, with models and RESTful API endpoints and MySQL database integration with CRUD operations

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages