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.
27 lines
816 B
JavaScript
27 lines
816 B
JavaScript
12 months ago
|
const express = require('express');
|
||
|
const courseController = require('../controllers/course');
|
||
|
|
||
|
// Routing Component
|
||
|
const router = express.Router();
|
||
|
// Auth import
|
||
|
const auth = require('../auth')
|
||
|
// Auth
|
||
|
const {verify,verifyAdmin} = auth;
|
||
|
// verifyng
|
||
|
|
||
|
|
||
|
router.post("/", verify,verifyAdmin, courseController.addCourse);
|
||
|
|
||
|
router.get('/all', courseController.getAllCourses);
|
||
|
router.get('/', courseController.getAllActive);
|
||
|
|
||
|
// wild card = it is dynamic means can be change by it's ID
|
||
|
router.get('/:courseId', courseController.getCourse);
|
||
|
|
||
|
router.put("/:courseId", verify, verifyAdmin, courseController.updateCourse);
|
||
|
|
||
|
router.put('/:courseId/archive', verify,verifyAdmin, courseController.archiveCourse)
|
||
|
router.put('/:courseId/activate', verify, verifyAdmin, courseController.activateCourse)
|
||
|
|
||
|
|
||
|
module.exports = router;
|