diff --git a/results1.js b/results1.js new file mode 100644 index 0000000..59e3694 --- /dev/null +++ b/results1.js @@ -0,0 +1,12 @@ +const express = require('express'); +const router = express.Router(); +const resultController = require('../controllers/results'); +const { protect, authorize } = require('../middlewares/auth'); + +router.post('/', protect, resultController.submitResult); +router.get('/my-results', protect, resultController.getUserResults); + +// 以下路由需要教师或管理员权限 +router.get('/exam/:id', protect, authorize('teacher', 'admin'), resultController.getExamResults); + +module.exports = router; \ No newline at end of file