{"id":31666040,"url":"https://github.com/rohit31-ui/quiz-app","last_synced_at":"2026-04-09T02:01:48.946Z","repository":{"id":317380653,"uuid":"1065342891","full_name":"Rohit31-ui/Quiz-app","owner":"Rohit31-ui","description":"A backend API for a Quiz Application that allows creating quizzes, adding questions with multiple options, fetching quizzes and questions, and supports single-choice, multiple-choice, and text-based questions.","archived":false,"fork":false,"pushed_at":"2025-09-30T13:51:06.000Z","size":10940,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-07T22:56:34.399Z","etag":null,"topics":["dotenv","expressjs","mongodb","mongoose","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rohit31-ui.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-27T14:31:33.000Z","updated_at":"2025-09-30T13:53:05.000Z","dependencies_parsed_at":"2025-09-30T15:34:28.637Z","dependency_job_id":null,"html_url":"https://github.com/Rohit31-ui/Quiz-app","commit_stats":null,"previous_names":["rohit31-ui/quiz-app"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Rohit31-ui/Quiz-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rohit31-ui%2FQuiz-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rohit31-ui%2FQuiz-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rohit31-ui%2FQuiz-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rohit31-ui%2FQuiz-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rohit31-ui","download_url":"https://codeload.github.com/Rohit31-ui/Quiz-app/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rohit31-ui%2FQuiz-app/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31581864,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"online","status_checked_at":"2026-04-09T02:00:06.848Z","response_time":112,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dotenv","expressjs","mongodb","mongoose","nodejs"],"created_at":"2025-10-07T22:56:06.464Z","updated_at":"2026-04-09T02:01:48.939Z","avatar_url":"https://github.com/Rohit31-ui.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🎯 Quiz Application Backend\n\n---\n\n## 📖 Project Description\nThis is a **simple backend API** for a Quiz Application. It allows you to:\n\n- ✅ Create quizzes with a title  \n- ✅ Add questions to quizzes, including multiple options, and mark correct answers  \n- ✅ Fetch all quizzes  \n- ✅ Fetch all questions (with options) for a specific quiz  \n\nThe API supports:  \n- **Single-choice questions**  \n- **Multiple-choice questions**  \n- **Text-based questions** (with a 300-character limit)\n\n---\n\n## 🛠️ Setup Instructions (Run Locally)\n\n### 1️⃣ Clone the repository\n```bash\ngit clone \u003cYOUR_REPO_URL\u003e\ncd Quiz-Application-Backend/server\n```\n\n### 2️⃣ Install dependencies\n```bash\nnpm install\n```\n\n### 3️⃣ Create `.env` file\nAdd the following variables in `.env` file:\n```env\nMONGODB_URL=mongodb://localhost:27017/quiz\nPORT=3000\n```\n\n### 4️⃣ Start the server\n```bash\n# Using nodemon\nnodemon server.js\n\n# Or using npm script if added\nnpm run dev\n```\n\n**API Base URL:**  \n```\nhttp://localhost:3000/api\n```\n\n---\n\n## 🚀 API Endpoints\n\n| Method | Endpoint | Description |\n|--------|---------|-------------|\n| POST   | /api/quizzes | Create a new quiz |\n| POST   | /api/quizzes/:quizId/questions | Add a question (with options) to a quiz |\n| GET    | /api/quizzes | Get all quizzes |\n| GET    | /api/quizzes/:quizId/questions | Get all questions (with options) for a quiz |\n\n---\n\n## 🧪 Running Test Cases\n\nYou can test the API using **Postman** or **VS Code REST Client**.\n\n### 1️⃣ Create Quiz\n**POST** `/api/quizzes`  \n**Body:**\n```json\n{\n  \"title\": \"JavaScript Basics\"\n}\n```\n\n### 2️⃣ Add Question\n**POST** `/api/quizzes/:quizId/questions`  \n**Body:**\n```json\n{\n  \"text\": \"What is the output of 1 + '1' in JavaScript?\",\n  \"type\": \"single\",\n  \"options\": [\n    { \"text\": \"11\", \"isCorrect\": true },\n    { \"text\": \"2\", \"isCorrect\": false }\n  ]\n}\n```\n\n### 3️⃣ Get All Quizzes\n**GET** `/api/quizzes`\n\n### 4️⃣ Get Quiz Questions\n**GET** `/api/quizzes/:quizId/questions`\n\n---\n\n## 💡 Assumptions and Design Choices\n\n- **Schemas**: Three separate schemas (`Quiz`, `Question`, `Option`) to keep data normalized  \n- **Question Types**: Supports `single`, `multiple`, and `text`  \n- **Option Correctness**: Correct answers stored using `isCorrect` field in `Option`  \n- **Validation**:\n  - Single-choice questions must have exactly one correct option  \n  - Multiple-choice questions must have at least one correct option  \n  - Text questions limited to 300 characters  \n- **Database**: MongoDB (local or cloud instance)\n\n---\n\n## 🛠️ Tech Stack\n\n- Node.js  \n- Express.js  \n- MongoDB  \n- Mongoose  \n- dotenv\n\n---\n\n## 🔗 GitHub Repository\n- [quiz app](https://github.com/Rohit31-ui/Quiz-app.git)\n\n---\n\n## 📫 Contact\n\n- **Email:** [rohitlad012@gmail.com](mailto:rohitlad012@gmail.com)  \n- **LinkedIn:** [https://www.linkedin.com/in/rohit-lad-1550b4259/](https://www.linkedin.com/in/rohit-lad-1550b4259/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohit31-ui%2Fquiz-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frohit31-ui%2Fquiz-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohit31-ui%2Fquiz-app/lists"}