text: const express = require("express");
  const {
    getProducts,
    getProductById,
    deleteProduct,
    createProduct,
    updateProduct,
    createProductReview,
    getTopProducts,
  } = require("./../controller/productController");
  const { protect, admin } = require("../middleware/authMiddleware");
  const router = express.Router();
  //const products = require("../data/products");
  
  router.route("/").get(getProducts).post(protect, admin, createProduct);
  router.route("/:id/reviews").post(protect, createProductReview);
  router.get("/top", getTopProducts);
  router
    .route("/:id")
    .get(getProductById)
    .delete(protect, admin, deleteProduct)
    .put(protect, admin, updateProduct);
  
  module.exports = router;
  