const express = require('express'); const router = express.Router(); const productController = require('../controllers/product'); const auth = require('./auth'); // Assuming you have an auth.js file with authentication middleware // Middleware for authorization token const authenticateToken = auth.authenticateToken; // Create a product route (accessible only by isAdmin) router.post('/create', authenticateToken, productController.createProduct); // Retrieve all products route (accessible to both admin and normal user) router.get('/all', productController.getAllProducts); // Retrieve all active products route (accessible to both admin and normal user) router.get('/active', productController.getActiveProducts); module.exports = router;