You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.2 KiB
JavaScript
42 lines
1.2 KiB
JavaScript
const express = require('express');
|
|
const productController = require('../controllers/product');
|
|
// console.log(userController);
|
|
// Routing Component
|
|
const router = express.Router();
|
|
// Auth import
|
|
const auth = require('../auth')
|
|
// Auth
|
|
const {verify,verifyAdmin} = auth;
|
|
// verifyng
|
|
|
|
|
|
|
|
|
|
// Route for user authenctication for log in
|
|
|
|
router.post("/product", verify,verifyAdmin,productController.createProduct);
|
|
|
|
router.get('/allproduct',productController.getAllProducts);
|
|
|
|
router.get('/activeproduct',productController.getactiveproduct);
|
|
|
|
|
|
router.get('/:productId',productController.getProduct);
|
|
|
|
router.put("/:productId", verify,verifyAdmin,productController.updateProduct);
|
|
|
|
router.put('/:productId/archive', productController.archiveProduct);
|
|
|
|
router.put('/:productId/activate', productController.activateProduct);
|
|
|
|
router.post('/search', productController.searchProductsByName);
|
|
|
|
// Route to search for courses by course price
|
|
router.post('/searchByPrice', productController.searchProductsByPriceRange);
|
|
|
|
// router.put('/products/:id',verify,verifyAdmin,productController.updateProduct);
|
|
|
|
// router.delete('/products/:id',verify,verifyAdmin,productController.deleteProduct);
|
|
|
|
|
|
module.exports = router; |