E-Commerce
E-Commerce is store consisting of various products that can showcased and sold ONLINE to the customers! It consists of features such as product-listing, cart, wishlist etc. similar to standard E-Commerce Apps (such as Amazon).
#
Auth RoutesIn E-Commerce App
, the authentication is done with email
and password
credential fields.
You can refer documentation related to Authentication here
#
Products RoutesThe following Routes are relating to Products. These are Publicly accessible routes.
/api/products
#
1. GET Request URL:
/api/products
HTTP Method: GET
Response Body:
{ data: { products: Array; }}
Functionality: This API call gets all products from the db.
/api/products/:productId
#
2. GET Request URL:
/api/products/:productId
HTTP Method: GET
Response Body:
{ data: { product: Object; }}
Functionality: This API call gets product by productId from the db.
#
Category RoutesThe following Routes are relating to Categories. These are Publicly accessible routes.
/api/categories
#
1. GET Request URL:
/api/categories
HTTP Method: GET
Response Body:
{ data: { categories: Array; }}
Functionality: This API call gets all categories from the db.
/api/categories/:categoryId
#
2. GET Request URL:
/api/categories/:categoryId
HTTP Method: GET
Response Body:
{ data: { category: Object; }}
Functionality: This API call gets category by categoryId from the db.
#
Cart RoutesThe following Routes are relating to User's Cart. These are private routes.
/api/user/cart
#
1. GET Request URL:
/api/user/cart
HTTP Method: GET
Request Headers:
authorization: encodedToken
Response Body:
{ data: { cart: Array; }}
Functionality: This API call gets all items of the cart from the db.
/api/user/cart
#
2. POST Request URL:
/api/user/cart
HTTP Method: POST
Request Headers:
authorization: encodedToken
Request Body:
{ product;}
Response Body:
{ data: { cart: Array; }}
Functionality: This API call adds a new item to the cart of the user in the db.
/api/user/cart/:productId
#
3. DELETE Request URL:
/api/user/cart/:productId
HTTP Method: DELETE
Request Headers:
authorization: encodedToken
Response Body:
{ data: { cart: Array; }}
Functionality: This API call removes an item from the cart of the user in the db.
/api/user/cart/:productId
#
4. POST Request URL:
/api/user/cart/:productId
HTTP Method: POST
Request Headers:
authorization: encodedToken
Request Body:
{ action: { type: "increment | decrement"; }}
Response Body:
{ data: { cart: Array; }}
Functionality: This API call updates an existing cart item quantity for the user in the db.
#
Wishlist RoutesThe following Routes are relating to User's Wishlist. These are private routes.
/api/user/wishlist
#
1. GET Request URL:
/api/user/wishlist
HTTP Method: GET
Request Headers:
authorization: encodedToken
Response Body:
{ data: { wishlist: Array; }}
Functionality: This API call gets all items of the wishlist from the db.
/api/user/wishlist
#
2. POST Request URL:
/api/user/wishlist
HTTP Method: POST
Request Headers:
authorization: encodedToken
Request Body:
{ product;}
Response Body:
{ data: { wishlist: Array; }}
Functionality: This API call adds a product to the wishlist of the user in the db.
/api/user/wishlist/:productId
#
3. DELETE Request URL:
/api/user/wishlist/:productId
HTTP Method: DELETE
Request Headers:
authorization: encodedToken
Response Body:
{ data: { wishlist: Array; }}
Functionality: This API call removes a product from the wishlist of the user in the db.