REST APIs for an e-commerce marketplace.
Build a REST API for an e-commerce marketplace. You will be building a set of REST API endpoints that enable the following functionality
● Buyers and sellers can register and login to the system
● Sellers can build a catalog of items, with each item having a name and price
● Buyers can GET a list of sellers
● Buyers can GET a specific seller's catalog (list of items)
● Buyers can create an Order that contains a list of items from the seller's catalog
● Sellers can GET a list of all orders they've received
Set up the node version v10.16.3 on your Local.
Node version - 10.16.3
npm version - 6.9.0
PS C:\Users\gajendra0180\Documents\GitHub\Hybr1d-Task> node -v
v10.16.3
PS C:\Users\gajendra0180\Documents\GitHub\Hybr1d-Task> npm -v
6.9.0
A step by step series of examples that tell you how to get a development env running.
npm install
And then
npm start
Do not forget to create the .env file from .env.example file
Following are the different entities in the system:
-
Users
○ Two types: buyers and sellers
○ A user can sign up as a buyer or as a seller
-
Catalogs
○ A catalog belongs to a seller
○ One seller can have one catalog
○ A catalog consists of Products
-
Products
○ A product has a name and a price
-
Orders
○ An order can be created by a buyer to purchase items from a seller's catalog
○ An order consists of a list of products
Following are a few examples of the API endpoints you should expose.
POST /api/auth/register
● Register a user (accept username, password, type of user - buyer/seller)
POST /api/auth/login
● Let a previously registered user log in (e.g. retrieve authentication token)
GET /api/buyer/list-of-sellers
● Get a list of all sellers
GET /api/buyer/seller-catalog/:seller_id
● Get the catalog of a seller by seller_id
POST /api/buyer/create-order/:seller_id
● Send a list of items to create an order for seller with id = seller_id
POST /api/seller/create-catalog
● Send a list of items to create a catalog for a seller
GET /api/seller/orders
● Retrieve the list of orders received by a seller
npm install
npm start
- @gajendra0180 - Author
- Stack Overflow :)
- Medium Articles