diff --git a/exams1.js b/exams1.js new file mode 100644 index 0000000..30931fc --- /dev/null +++ b/exams1.js @@ -0,0 +1,13 @@ +const express = require('express'); +const router = express.Router(); +const examController = require('../controllers/exams'); +const { protect, authorize } = require('../middlewares/auth'); + +router.get('/', examController.getExams); +router.get('/:id', examController.getExam); +router.post('/:id/validate', protect, examController.validateAnswers); + +// 以下路由需要教师或管理员权限 +router.post('/', protect, authorize('teacher', 'admin'), examController.createExam); + +module.exports = router; \ No newline at end of file