Finish admin dashboard and update sql code

This commit is contained in:
estherdev03
2025-04-20 05:56:31 -06:00
commit 68d2b950c0
28 changed files with 4144 additions and 0 deletions

34
backend/routes/product.js Normal file
View File

@@ -0,0 +1,34 @@
// routes/product.js
const express = require("express");
const {
addFavorite,
getFavorites,
removeFavorite,
getAllProducts,
getProductById,
getProductWithPagination,
removeProduct,
} = require("../controllers/product");
const router = express.Router();
// Add detailed logging middleware
router.use((req, res, next) => {
console.log(`Incoming ${req.method} request to ${req.path}`);
next();
});
router.post("/addFavorite", addFavorite);
router.post("/getFavorites", getFavorites);
router.post("/delFavorite", removeFavorite);
router.get("/getProduct", getAllProducts);
//Get products with pagination
router.get("/getProductWithPagination", getProductWithPagination);
router.get("/:id", getProductById); // Simplified route
//Remove product
router.delete("/:id", removeProduct);
module.exports = router;