Welcome!
Trivia is a wonderful quiz game where a user is invited to answer questions and get scored after!
Questions are of any or choosen category.
Screencast.from.06-09-2022.23.07.28.webm
The app implement both the api for all the functionalities you need for a trivia game and additionaly a frontend that help you play the game on a graphical User interface.
- For runing the backend (APi) please visit this link
- For runing the frontend and actually test the app visit this link
GET /api/v1/categories
Parameter | Type | Description |
---|---|---|
None | - | Fetches a dictionary of categories in which the keys are the ids and the value is the corresponding string of the category |
Sample Response body
{
"categories": {
"1": "Science",
"2": "Art",
"3": "Geography",
"4": "History",
"5": "Entertainment",
"6": "Sports"
}
}
GET /api/v1/questions?page=${integer}
Parameter | Type | Description | Returns |
---|---|---|---|
Required: page |
integer |
Fetches a paginated set of questions, a total number of questions, all categories and current category string | An object with 10 paginated questions, total questions, object including all categories, and current category string |
Sample Response body
{
"questions": [
{
"id": 1,
"question": "This is a question",
"answer": "This is an answer",
"difficulty": 5,
"category": 2
}
],
"totalQuestions": 100,
"categories": {
"1": "Science",
"2": "Art",
"3": "Geography",
"4": "History",
"5": "Entertainment",
"6": "Sports"
},
"currentCategory": "History"
}
GET /api/v1/categories/${id}/questions
Parameter | Type | Description | Returns |
---|---|---|---|
Required: id |
integer |
Fetches questions for a cateogry specified by id request argument | An object with questions for the specified category, total questions, and current category string |
Sample Response body
{
"questions": [
{
"id": 1,
"question": "This is a question",
"answer": "This is an answer",
"difficulty": 5,
"category": 4
}
],
"totalQuestions": 100,
"currentCategory": "History"
}
DELETE /api/v1/questions/${id}
Parameter | Type | Description | Returns |
---|---|---|---|
Required: id |
integer |
Deletes a specified question using the id of the question | The ID of the deleted question |
Sample Response body
{
"success" : true,
"id" : 10
}
POST /api/v1/quizzes
Sample Request body
{
"previous_questions": [1, 4, 20, 15],
"quiz_category": "History"
}
Param | Type | Description | Returns |
---|---|---|---|
Required: The request body |
json |
Sends a post request in order to get the next question | A single new question object |
Sample Response body
{
"question": {
"id": 1,
"question": "This is a question",
"answer": "This is an answer",
"difficulty": 5,
"category": 4
}
}
POST /api/v1/questions
Parameter | Type | Description | Returns |
---|---|---|---|
Required: Request Body |
json |
Sends a post request in order to add a new question | The ID of the new question |
Sample Request body
{
"question": "Heres a new question string",
"answer": "Heres a new answer string",
"difficulty": 1,
"category": 3
}
Sample Response body
{
"id": 38
}
POST /api/v1/questions
Parameter | Type | Description | Returns |
---|---|---|---|
Required: Request Body |
json |
Sends a post request in order to search for a specific question by search term | Any array of questions, a number of totalQuestions that met the search term and the current category string |
Sample Request body
{
"searchTerm": "this is the term the user is looking for"
}
Sample Response body
{
"questions": [
{
"id": 1,
"question": "This is a question",
"answer": "This is an answer",
"difficulty": 5,
"category": 5
}
],
"totalQuestions": 100,
"currentCategory": "Entertainment"
}
- Udacity And all the lecturers over there
React, Javascript, Python, Flask, SQLAlchemy ORM, PostgreSQL...
I'm a generalist web developer & entrepreneur, driven by curiosity, positivity, and a can-do attitude;i like to code web application projects with various stack.