{"id":27385806,"url":"https://github.com/jignesh6775/quiz_applicaton","last_synced_at":"2026-04-11T10:32:42.574Z","repository":{"id":213303856,"uuid":"733450990","full_name":"Jignesh6775/Quiz_Applicaton","owner":"Jignesh6775","description":"This is the backend for a quiz application built using Node.js, Express.js, and MongoDB.","archived":false,"fork":false,"pushed_at":"2023-12-19T15:03:35.000Z","size":45,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-19T08:02:46.007Z","etag":null,"topics":["express-js","mongodb","mongoose","nodejs","quizapp","rest-api"],"latest_commit_sha":null,"homepage":"https://quiz-app-lp1g.onrender.com/","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/Jignesh6775.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}},"created_at":"2023-12-19T11:03:52.000Z","updated_at":"2024-01-02T08:58:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"f31cc1c0-16af-41df-9a84-03cf5f19e975","html_url":"https://github.com/Jignesh6775/Quiz_Applicaton","commit_stats":null,"previous_names":["jignesh6775/quiz_applicaton"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Jignesh6775/Quiz_Applicaton","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jignesh6775%2FQuiz_Applicaton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jignesh6775%2FQuiz_Applicaton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jignesh6775%2FQuiz_Applicaton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jignesh6775%2FQuiz_Applicaton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jignesh6775","download_url":"https://codeload.github.com/Jignesh6775/Quiz_Applicaton/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jignesh6775%2FQuiz_Applicaton/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274396927,"owners_count":25277398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-09T02:00:10.223Z","response_time":80,"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":["express-js","mongodb","mongoose","nodejs","quizapp","rest-api"],"created_at":"2025-04-13T16:40:42.461Z","updated_at":"2025-12-30T19:51:03.551Z","avatar_url":"https://github.com/Jignesh6775.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Quiz Application Backend\n\nThis is the backend for a quiz application built using Node.js, Express.js, and MongoDB.\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Routes](#routes)\n  - [User Authentication](#user-authentication)\n  - [Quiz Management](#quiz-management)\n- [Usage](#usage)\n  - [Creating a User Account](#creating-a-user-account)\n  - [Logging In](#logging-in)\n  - [Creating a Quiz](#creating-a-quiz)\n  - [Getting the Active Quiz](#getting-the-active-quiz)\n  - [Getting Quiz Results](#getting-quiz-results)\n  - [Getting All Quizzes](#getting-all-quizzes)\n\n## Installation\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/your-username/quiz-backend.git\n   cd quiz-backend\n   ```\n\n2. Install dependencies:\n\n   ```bash\n   npm install\n   ```\n\n3. Set up your MongoDB connection by creating a `.env` file in the root directory with the following content:\n\n   ```env\n   MONGO_URL=your-mongodb-connection-string\n   JWT_SECRET=your-secret-key\n   ```\n\n   Replace `your-mongodb-connection-string` with your MongoDB connection string and `your-secret-key` with a secure secret key for JWT.\n\n4. Run the application:\n\n   ```bash\n   npm start\n   ```\n\n   The server will be running on http://localhost:3000 by default.\n\n## Routes\n\n### User Authentication\n\n| Method | Endpoint         | Description              | Authentication Required |\n| ------ | ----------------- | ------------------------ | ------------------------ |\n| POST   | `/auth/signup`   | Create a new user        | No                       |\n| POST   | `/auth/login`    | Log in an existing user  | No                       |\n\n### Quiz Management\n\n| Method | Endpoint        | Description                         | Authentication Required |\n| ------ | --------------- | ----------------------------------- | ------------------------ |\n| POST   | `/quizzes`      | Create a new quiz                   | Yes                      |\n| GET    | `/quizzes/active`| Get the currently active quiz       | Yes                      |\n| GET    | `/quizzes/:id/result`| Get quiz results after 5 minutes of end time | Yes                      |\n| GET    | `/quizzes/all`  | Get all quizzes (including inactive) | Yes                      |\n\n## Usage\n\n### Creating a User Account\n\n**Endpoint**: `/auth/signup`\n\n**Method**: POST\n\n**Example Payload**:\n\n```json\n{\n  \"username\": \"john_doe\",\n  \"password\": \"securepassword\"\n}\n```\n\n### Logging In\n\n**Endpoint**: `/auth/login`\n\n**Method**: POST\n\n**Example Payload**:\n\n```json\n{\n  \"username\": \"john_doe\",\n  \"password\": \"securepassword\"\n}\n```\n\n**Response**:\n\n```json\n{\n  \"token\": \"your-json-web-token\"\n}\n```\n\nUse the obtained token for authentication in subsequent requests.\n\n### Creating a Quiz\n\n**Endpoint**: `/quizzes`\n\n**Method**: POST\n\n**Example Payload**:\n\n```json\n{\n  \"title\": \"Sample Quiz\",\n  \"questions\": [\n    {\n      \"question\": \"What is the capital of France?\",\n      \"options\": [\"Berlin\", \"Paris\", \"Madrid\", \"Rome\"],\n      \"rightAnswer\": 1\n    },\n    // ... (add more questions)\n  ],\n  \"startDate\": \"2023-12-15T08:00:00.000Z\",\n  \"endDate\": \"2023-12-15T10:00:00.000Z\"\n}\n```\n\n### Getting the Active Quiz\n\n**Endpoint**: `/quizzes/active`\n\n**Method**: GET\n\n**Response**:\n\n```json\n{\n  \"title\": \"Sample Quiz\",\n  \"questions\": [\n    {\n      \"question\": \"What is the capital of France?\",\n      \"options\": [\"Berlin\", \"Paris\", \"Madrid\", \"Rome\"],\n      \"rightAnswer\": 1\n    },\n    // ... (more questions)\n  ],\n  \"startDate\": \"2023-12-15T08:00:00.000Z\",\n  \"endDate\": \"2023-12-15T10:00:00.000Z\",\n  \"active\": true\n}\n```\n\n### Getting Quiz Results\n\n**Endpoint**: `/quizzes/:id/result`\n\n**Method**: GET\n\n**Example URL**: `/quizzes/your-quiz-id/result`\n\n**Payload**: `Provide answers payload so it can compare your answers with right answer and return you result as response.`\n\n```json\n{\n  \"answers\":[1, 1, 0, 1, 1]\n}\n\n```\n\n**Response**:\n\n```json\n{\n  \"totalQuestions\": 5,\n  \"correctAnswers\": 3,\n  \"score\": 60\n}\n```\n\n### Getting All Quizzes\n\n**Endpoint**: `/quizzes/all`\n\n**Method**: GET\n\n**Response**:\n\n```json\n[\n  {\n    \"title\": \"Sample Quiz 1\",\n    // ... (quiz details)\n  },\n\n\n  {\n    \"title\": \"Sample Quiz 2\",\n    // ... (quiz details)\n  },\n  // ... (more quizzes)\n]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjignesh6775%2Fquiz_applicaton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjignesh6775%2Fquiz_applicaton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjignesh6775%2Fquiz_applicaton/lists"}