feat: 实现成绩管理系统核心功能
添加响应工具、错误处理中间件和数据库模型 创建用户、学生、课程和成绩相关服务 实现管理员、教师和学生控制器的基本功能 重构路由处理并优化数据库查询
This commit is contained in:
16
backend/utils/response.js
Normal file
16
backend/utils/response.js
Normal file
@@ -0,0 +1,16 @@
|
||||
const success = (res, data = null, message = 'Success') => {
|
||||
res.json({
|
||||
success: true,
|
||||
message,
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
const error = (res, message = 'Internal Server Error', statusCode = 500) => {
|
||||
res.status(statusCode).json({
|
||||
success: false,
|
||||
message
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = { success, error };
|
||||
Reference in New Issue
Block a user