📅  最后修改于: 2023-12-03 15:23:05.877000             🧑  作者: Mango
圈子在线测验区域是一个提供在线测验功能的平台。在这里,你可以创建自己的测验,并将其分享给其他用户。同时,你也可以参加其他用户创建的测验,测试自己的知识水平。
.
├── client # 前端代码
│ ├── public # 静态资源
│ │ ├── index.html
│ │ └── ...
│ ├── src # 前端源码目录
│ │ ├── api # API调用相关代码
│ │ ├── components # React组件
│ │ ├── pages # 页面组件
│ │ ├── styles # 样式
│ │ └── index.js # 前端入口文件
│ ├── package.json
│ └── ...
├── server # 后端代码
│ ├── bin # 启动脚本
│ ├── config # 配置文件
│ ├── controllers # 路由处理函数
│ ├── models # 数据库模型
│ ├── routes # 路由配置
│ ├── app.js # 后端入口文件
│ └── package.json
├── package.json
└── ...
git clone https://github.com/your-username/quiz-app.git
cd quiz-app
npm install
cd client
npm start
cd server
npm start
GET /api/quizzes
Query Params:
page
{Number} 当前页数,默认为 1limit
{Number} 每页的数据条数,默认为 10Response:
data
{Array} 测验列表_id
{String} IDtitle
{String} 标题description
{String} 描述createdAt
{Date} 创建时间updatedAt
{Date} 更新时间questions
{Array} 问题列表_id
{String} IDtitle
{String} 标题options
{Array} 选项列表_id
{String} IDtitle
{String} 标题answer
{String} 答案POST /api/quizzes
Request Body:
title
{String} 标题description
{String} 描述questions
{Array} 问题列表title
{String} 标题options
{Array} 选项列表title
{String} 标题answer
{String} 答案Response:
data
{Object} 创建的测验数据_id
{String} IDtitle
{String} 标题description
{String} 描述createdAt
{Date} 创建时间updatedAt
{Date} 更新时间questions
{Array} 问题列表_id
{String} IDtitle
{String} 标题options
{Array} 选项列表_id
{String} IDtitle
{String} 标题answer
{String} 答案POST /api/quizzes/:quizId/submit
Request Body:
answers
{Array} 答案列表questionId
{String} 问题IDanswer
{String} 答案Response:
data
{Object} 提交的测验答案数据_id
{String} IDquiz
{ObjectId} 对应测验IDuserId
{ObjectId} 用户IDanswers
{Array} 答案列表question
{ObjectId} 问题IDanswer
{String} 答案score
{Number} 得分以上API仅供参考,具体实现细节请查看代码。