https://github.com/kimgoetzke/hyperskill-project-web-quiz-engine
Java practice app with API to post/get/delete quizzes using the Spring framework, created for 'Java Backend Developer' track on Hyperskill.
https://github.com/kimgoetzke/hyperskill-project-web-quiz-engine
api database h2 java spring
Last synced: 3 months ago
JSON representation
Java practice app with API to post/get/delete quizzes using the Spring framework, created for 'Java Backend Developer' track on Hyperskill.
- Host: GitHub
- URL: https://github.com/kimgoetzke/hyperskill-project-web-quiz-engine
- Owner: kimgoetzke
- License: mit
- Created: 2023-01-11T14:20:30.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-02-02T10:25:12.000Z (over 3 years ago)
- Last Synced: 2025-06-13T05:05:29.122Z (about 1 year ago)
- Topics: api, database, h2, java, spring
- Language: Java
- Homepage:
- Size: 36.1 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# The Web Quiz Engine Project
This repo contains my second project in Java. It was created in January 2023 for the 'Java Backend Developer' track on Hyperskill (JetBrains Academy).
**About the course**: [https://hyperskill.org/tracks/12](https://hyperskill.org/tracks/12)
**About the project**: [https://hyperskill.org/projects/91](https://hyperskill.org/projects/91)
**Hyperskill project difficulty rating**: Challenging
In this project, I have developed a multi-users web service for creating and solving quizzes. Some key features include:
+ An API with a Spring Boot REST controller offering endpoints for creating users and adding/requesting/completing/deleting quizzes
+ Pagination for responses returning more than 10 results e.g. all questions or all individual completions
+ Using Sprint Crypto to implement BCrypt encoding for passwords
+ Using Sprint Security to allow only authorised users access (except for user registration)
+ A locally stored H2 database to store quizzes
+ Processing and returning data in JSON format
## Example

## Available endpoints
#### Register user
POST `api/register`
+ Expects JSON with `email` (valid email) and `password` (5 character minimum)
+ Example:
`{
"email": "test@email.com",
"password": "password"
}`
+ Returns HTTP status code (`200` or `400`) based on success
#### Create quiz
POST `api/quizzes`
+ Expects JSON with `title`, `text` (i.e. displayed question), `options` (min 2), and `answer` (0 possible) and authorisation
+ Example:
`{
"title": "A question with two correct answers",
"text": "2 + 2 = ?",
"options": ["2","1 * 4","6 + 2","5 - 1"],
"answer": [1,3]
}`
+ If successful, returns JSON with all submitted fields plus `id` and HTTP status `200`, otherwise `401` if unauthorised
#### Solve quiz
POST `api/quizzes/{id}/solve`
+ Expects JSON with `answer` (can be empty) and authorisation
+ Example:
`{
"answer": [1,3]
}`
+ If successful, returns JSON with `success` true/false and `feedback` and HTTP status `200`, otherwise `401` if unauthorised
#### Get quiz
GET `api/quizzes/{id}`
+ Expects authorisation, no body required
+ Returns JSON with `id`, `title`, `text`, `options` and HTTP status `200` if successful, or `401`/`404` if unauthorised/not found
#### Get all quizzes
GET `api/quizzes`
+ Expects authorisation, no body required
+ Accepts `?page=` and `?size=` (number of items per page returned)
+ Returns sorted and paginated JSON with all quizzes and HTTP status `200` if successful, or `401` if unauthorised
#### Get all completions
GET `api/quizzes/completed`
+ Expects authorisation, no body required
+ Accepts `?page=` and `?size=` (number of items per page returned)
+ Returns sorted and paginated JSON with all completions for requestor and HTTP status `200` if successful, or `401` if unauthorised
#### Delete quiz
DELETE `api/quizzes/{id}`
+ Expects authorisation, no body required
+ Returns HTTP status `204` if successful, or `403`/`404` if not the owner/not found