This commit is contained in:
36
routes/categoryRoutes.js
Normal file
36
routes/categoryRoutes.js
Normal file
@@ -0,0 +1,36 @@
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const categoryController = require('../controllers/categoryController');
|
||||
|
||||
/**
|
||||
* Category Routes
|
||||
*/
|
||||
|
||||
// GET /api/categories - Get all categories with pagination
|
||||
router.get('/', categoryController.getAllCategories);
|
||||
|
||||
// GET /api/categories/active - Get all active categories
|
||||
router.get('/active', categoryController.getActiveCategories);
|
||||
|
||||
// GET /api/categories/datatypes/schema - Get category datatypes
|
||||
router.get('/datatypes/schema', categoryController.getCategoryDatatypes);
|
||||
|
||||
// GET /api/categories/code/:code - Get category by code
|
||||
router.get('/code/:code', categoryController.getCategoryByCode);
|
||||
|
||||
// GET /api/categories/:id - Get category by ID
|
||||
router.get('/:id', categoryController.getCategoryById);
|
||||
|
||||
// GET /api/categories/:id/subjects - Get subjects by category
|
||||
router.get('/:id/subjects', categoryController.getSubjectsByCategory);
|
||||
|
||||
// POST /api/categories - Create new category
|
||||
router.post('/', categoryController.createCategory);
|
||||
|
||||
// PUT /api/categories/:id - Update category
|
||||
router.put('/:id', categoryController.updateCategory);
|
||||
|
||||
// DELETE /api/categories/:id - Delete category
|
||||
router.delete('/:id', categoryController.deleteCategory);
|
||||
|
||||
module.exports = router;
|
||||
Reference in New Issue
Block a user