From 7f0c51024ea9213d91a0c89e53e3620d966dcc81 Mon Sep 17 00:00:00 2001 From: phgkfux43 <3469266505@qq.com> Date: Sat, 26 Apr 2025 22:39:48 +0800 Subject: [PATCH] ADD file via upload --- exams1.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 exams1.js 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