This is a Nodejs backend for category wise product. This backend is developed using Express.js. This backend is connected with MongoDB database with mongoose.
To install this backend you need to clone this repository and run npm install
to install all the dependencies.
After that you need to run npm start
to start the server.
GET http://localhost:5000/categories
- to get all categoriesPOST http://localhost:5000/categories
- To create a new category (please provide the category name in the request body)
GET http://localhost:5000/categories/:categoryId/products
- Fetch products by a specific category IDPOST http://localhost:5000/categories/:categoryId/products
- Add a new product to a specific category (provide product name and quantity in the request body)
category id is the id of the category which is created by mongodb. i have used postman to test the api i have created 4 category and 2 product for each category
apple
- 64c6a36e47f2cbc61f50e243
samsung
- 64c6a5bb47f2cbc61f50e24d
xiaomi
- 64c6a5c347f2cbc61f50e24f
OPPO
- 64c6a5ce47f2cbc61f50e251
express
mongoose
nodemon
cors
body-parser
Mehedi Hasan Khairul