{"id":18686655,"url":"https://github.com/danijeldragicevic/web-quiz-engine","last_synced_at":"2026-05-09T00:02:05.256Z","repository":{"id":172155993,"uuid":"626908356","full_name":"danijeldragicevic/web-quiz-engine","owner":"danijeldragicevic","description":"Service able to create and manage quizzes, by the authenticated users.","archived":false,"fork":false,"pushed_at":"2023-04-20T12:47:41.000Z","size":99,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-07T11:35:43.546Z","etag":null,"topics":["h2-database","hyperskill-solutions","lombok-gradle","native-query","pagination","spring-boot","spring-data-jpa","spring-mvc","spring-rest","spring-security","spring-validation"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danijeldragicevic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2023-04-12T11:59:46.000Z","updated_at":"2023-04-20T12:46:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"17bca8c8-265e-4b65-ab67-0c0117732429","html_url":"https://github.com/danijeldragicevic/web-quiz-engine","commit_stats":null,"previous_names":["danijeldragicevic/web-quiz-engine"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/danijeldragicevic/web-quiz-engine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danijeldragicevic%2Fweb-quiz-engine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danijeldragicevic%2Fweb-quiz-engine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danijeldragicevic%2Fweb-quiz-engine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danijeldragicevic%2Fweb-quiz-engine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danijeldragicevic","download_url":"https://codeload.github.com/danijeldragicevic/web-quiz-engine/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danijeldragicevic%2Fweb-quiz-engine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32802533,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"ssl_error","status_checked_at":"2026-05-08T08:22:45.650Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["h2-database","hyperskill-solutions","lombok-gradle","native-query","pagination","spring-boot","spring-data-jpa","spring-mvc","spring-rest","spring-security","spring-validation"],"created_at":"2024-11-07T10:28:27.389Z","updated_at":"2026-05-09T00:02:05.239Z","avatar_url":"https://github.com/danijeldragicevic.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Web Quiz Engine\nService who is able to create and manage quizzes by the authenticated users. \u003cbr\u003e\nApplication is able to:\n- create new users,\n- create new quizzes,\n- retrieve quizzes by their id,\n- retrieve all quizzes paginated,\n- place solutions on quizzes,\n- retrieve all solutions paginated and\n- delete quizzes by their id.\n\nApplication use embedded H2 database and Basic authentication.\n\n# Technology\n- Java 11\n- Spring Boot 2.7.10 (Spring Web MVC, Spring REST, Spring Data Jpa, Spring Security, Spring Validation, Project Lombok, H2 database, Pagination, Native Query)\n- Gradle 7.4\n\n# To run application:\nNavigate to the project root directory and run **./gradlew bootRun**\n\n# Exposed endpoints:\nBy default, service will run on **http://localhost:8889** \u003cbr/\u003e\nFollowing endpoints will be exposed:\n\n| Methods | Urls                          | Action                                                   | Access                      |\n|---------|-------------------------------|----------------------------------------------------------|-----------------------------|\n| GET     | /h2                           | Access to the local database (username: sa, no password) | No authentication needed    |\n| POST    | /api/register                 | Register new user                                        | No authentication needed    |\n|         |                               |                                                          |                             |\n| POST    | /api/quizzes                  | Create new quiz                                          | Authenticated user required |\n| GET     | /api/quizzes/{id}             | Get quiz by it's id                                      | Authenticated user required |\n| GET     | /api/quizzes?page=0           | Get all quizzes, paginated (5 records per page)          | Authenticated user required |\n| POST    | /api/quizzes/{id}/solve       | Place solution for the quiz                              | Authenticated user required |\n| GET     | /api/quizzes/completed?page=0 | Get completed quizzes, paginated (5 records per page)    | Authenticated user required |\n| DELETE  | /api/quizzes/{id}             | Delete quiz by it's id                                   | Authenticated user required |\n\n# Examples\n### API calls\n**Example 1:** Registering a new user with a valid request body: \u003cbr\u003e\nRequest: `POST /api/register` \u003cbr\u003e\nRequest body: \u003cbr\u003e\n```\n{\n  \"email\": \"test@mail.org\",\n  \"password\": \"strongpassword\"\n}\n```\nResponse code: `200 OK`\n```\n{\n  \"message\": \"User successfully created.\"\n}\n```\n\n**Example 2:** Registering a new user with a valid request body but the email address is already taken: \u003cbr\u003e\nRequest: `POST /api/register` \u003cbr\u003e\nRequest body: \u003cbr\u003e\n```\n{\n  \"email\": \"test@mail.org\",\n  \"password\": \"strongpassword\"\n}\n```\nResponse code: `400 BAD REQUEST` \u003cbr\u003e\n\n**Example 3:** Registering a new user with an invalid email: \u003cbr\u003e\nRequest: `POST /api/register` \u003cbr\u003e\nRequest body: \u003cbr\u003e\n```\n{\n  \"email\": \"test@mailorg\",\n  \"password\": \"strongpassword\"\n}\n```\nResponse code: `400 BAD REQUEST` \u003cbr\u003e\n\n**Example 4:** Registering a new user with a too short password: \u003cbr\u003e\nRequest: `POST /api/register` \u003cbr\u003e\nRequest body: \u003cbr\u003e\n```\n{\n  \"email\": \"test@mail.org\",\n  \"password\": \"1234\"\n}\n```\nResponse code: `400 BAD REQUEST` \u003cbr\u003e\n\n#### Requesting all other endpoints without valid username and password will return response code `401 UNAUTHORIZED`. \u003cbr\u003e\n\n**Example 5:** Creating a new quiz: \u003cbr\u003e\nRequest: `POST /api/quizzes` \u003cbr\u003e\nRequest body: \u003cbr\u003e\n```\n{\n  \"title\": \"The Java Logo\",\n  \"text\": \"What is depicted on the Java logo?\",\n  \"options\": [\"Robot\",\"Tea leaf\",\"Cup of coffee\",\"Bug\"],\n  \"answers\": [2]\n}\n```\nResponse code: `200 OK` \u003cbr\u003e\nResponse body: \u003cbr\u003e\n```\n{\n  \"id\": 1,\n  \"title\": \"The Java Logo\",\n  \"text\": \"What is depicted on the Java logo?\",\n  \"options\": [\"Robot\",\"Tea leaf\",\"Cup of coffee\",\"Bug\"]\n}\n```\n\n**Example 6:** Getting an existing quiz by id: \u003cbr\u003e\nRequest: `GET /api/quizzes/1` \u003cbr\u003e\nResponse code: `200 OK` \u003cbr\u003e\nResponse body: \u003cbr\u003e\n```\n{\n  \"id\": 1,\n  \"title\": \"The Java Logo\",\n  \"text\": \"What is depicted on the Java logo?\",\n  \"options\": [\"Robot\",\"Tea leaf\",\"Cup of coffee\",\"Bug\"]\n}\n```\n\n**Example 7:** Getting a non-existing quiz by id: \u003cbr\u003e\nRequest: `GET /api/quizzes/15` \u003cbr\u003e\nResponse code: `404 NOT FOUND` \u003cbr\u003e\n\n**Example 8:** Getting the first page of the total list of all quizzes created: \u003cbr\u003e\nRequest: `GET /api/quizzes?page=0` \u003cbr\u003e\nResponse code: `200 OK` \u003cbr\u003e\nResponse body: \u003cbr\u003e\n```\n[\n  {\n    \"id\": 1,\n    \"title\": \"The Java Logo\",\n    \"text\": \"What is depicted on the Java logo?\",\n    \"options\": [\"Robot\", \"Tea leaf\", \"Cup of coffee\", \"Bug\"]\n  },\n  {\n    \"id\": 2,\n    \"title\": \"The Ultimate Question\",\n    \"text\": \"What is the answer to the Ultimate Question of Life, the Universe and Everything?\",\n    \"options\": [\"Everything goes right\", \"42\", \"2+2=4\", \"11011100\"]\n  },\n  {\n    \"id\": 3,\n    \"title\": \"The biggest planet\",\n    \"text\": \"Who is the biggest planet in the solar system?\",\n    \"options\": [ \"Venus\", \"Uranus\", \"Earth\", \"Jupiter\"]\n  }\n]\n```\n\n**Example 9:** Solving an existing quiz with a correct answer: \u003cbr\u003e\nRequest: `POST /api/quizzes/1/solve` \u003cbr\u003e\nRequest body: \u003cbr\u003e\n```\n{\n  \"answers\": [2]\n}\n```\nResponse code: `200 OK` \u003cbr\u003e\nResponse body: \u003cbr\u003e\n```\n{\n  \"success\": \"true\",\n  \"feedback\": \"Congratulations, you're right!\"\n}\n```\n\n**Example 10:** Solving an existing quiz with a wrong answer: \u003cbr\u003e\nRequest: `POST /api/quizzes/1/solve` \u003cbr\u003e\nRequest body: \u003cbr\u003e\n```\n{\n  \"answers\": [2, 3]\n}\n```\nResponse code: `200 OK` \u003cbr\u003e\nResponse body: \u003cbr\u003e\n```\n{\n  \"success\": \"false\",\n  \"feedback\": \"Wrong answer! Please, try again.\"\n}\n```\n\n**Example 11:** Solving an non-existing quiz: \u003cbr\u003e\nRequest: `POST /api/quizzes/15/solve` \u003cbr\u003e\nRequest body: \u003cbr\u003e\n```\n{\n  \"answers\": [2, 3]\n}\n```\nResponse code: `404 NOT FOUND` \u003cbr\u003e\n\n**Example 12:** Getting the first page of the total list of completed quizzes, for the authenticated user: \u003cbr\u003e\nRequest: `GET /api/quizzes/completed?page=0` \u003cbr\u003e\nResponse code: `200 OK` \u003cbr\u003e\nResponse body: \u003cbr\u003e\n```\n{\n  \"content\": [\n    { \"id\": 1, \"completedAt\": \"2023-04-20T14:15:04.421949\" },\n    { \"id\": 2, \"completedAt\": \"2023-04-20T14:14:55.776697\" },\n    { \"id\": 3, \"completedAt\": \"2023-04-20T14:14:43.296623\" },\n    { \"id\": 1, \"completedAt\": \"2023-04-20T14:13:17.517454\" },\n    { \"id\": 3, \"completedAt\": \"2023-04-20T14:13:01.900892\" }\n  ]\n}\n```\n\n**Example 13:** Delete quiz by id, authenticated as user who did create it: \u003cbr\u003e\nRequest: `DELETE /api/quizzes/1` \u003cbr\u003e\nResponse code: `200 OK` \u003cbr\u003e\nResponse body: \u003cbr\u003e\n```\n{\n  \"message\": \"Quiz successfully deleted.\"\n}\n```\n\n**Example 14:** Delete quiz by id, authenticated as user who did not create it: \u003cbr\u003e\nRequest: `DELETE /api/quizzes/2` \u003cbr\u003e\nResponse code: `403 FORBIDDEN`\n\n# Licence\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanijeldragicevic%2Fweb-quiz-engine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanijeldragicevic%2Fweb-quiz-engine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanijeldragicevic%2Fweb-quiz-engine/lists"}