-
Notifications
You must be signed in to change notification settings - Fork 0
/
router.js
32 lines (27 loc) · 1.53 KB
/
router.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const express = require("express");
const customerController = require("./controllers/customers");
const productController = require("./controllers/products");
const orderController = require("./controllers/orders");
const router = express.Router();
// Customers
router.get("/getAllCustomers", customerController.getAllCustomers)
router.get("/getCustomer/:id", customerController.getCustomerById)
router.post("/getOrCreateCustomer", customerController.addCustomer)
router.put("/updateCustomer", customerController.updateCustomerById)
router.delete("/deleteCustomer", customerController.deleteCustomerById)
// Products
router.get("/getAllProducts", productController.getAllProducts)
router.get("/getProduct/:name", productController.getProductByName)
router.post("/addProduct", productController.addProducts)
router.put("/updateProductName", productController.updateProductName)
router.put("/updateProductQuantityLeft", productController.updateProductLeftQuantityByName)
router.put("/updateProductTotalQuantity", productController.updateProductTotalQuantityByName)
router.delete("/deleteProduct", productController.deleteProductByName)
// Orders
router.get("/getAllOrders", orderController.getAllOrders)
router.get("/getOrderById/:id", orderController.getOrderById)
router.post("/placeOrder", orderController.placeOrder)
router.post("/completeOrder", orderController.completeOrder)
router.post("/getOrderRawDetailsById", orderController.getOrderRawDetailsById)
router.post("/getOrderDetailsById", orderController.getOrderDetailsById)
module.exports = router;