Products && Categories REST API'S
-
Open configs/mongo-config.js and change mongo url with your mongodb credentials and make sure mongodb is running.
-
Navigate to application folder in terminal and run "npm install".
-
Navigate to application folder in terminal and run "node app.js".
-
Now the application will be running on port 3200.
-
Install Docker on your system.
-
Navigate to application folder in terminal and run "docker-compose up -d".
-
Run the command "docker ps" to check whether mongo and app services are running.
-
If the two docker services are up , Now the application is running on port 3200.
-
"/addcategory" -- Post API to add categories. Required body params -- categoryname
-
"/addsubcategory/:id" -- Put API to add child categories(id of category). Required body params -- categoryname
-
"/categories" -- Get API to get all categories and its child categories.
-
"/addproduct" -- Post API to add products. Requiered body params -- title -- description -- imagepath -- size -- color -- quantity -- price -- category (if only 1 category)(should post id of category) -- category (to add multiple categories send category param multiple times with different values). Note : Should post id of category in category field.
-
"/updateproductdetails/:id" -- Put API to update productdetails.(id of product) Requiered body params -- title -- description -- imagepath -- size -- color -- quantity -- price (any one param is required)
-
"/products" -- Get API to get all products and its details.
-
"/products/:id" -- Get API to get single product details of id.
-
"/productsbycat/:id" -- Get API to get products based on categories (id of category).
host = http://localhost:3200
Example API : http://localhost:3200/products