Skip to content

kulothunganug/quiz-maker-backend

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Quiz maker app backend

gin - web framework gorm - handles database render - hosting service

Endpoints

POST: /api/v1/quizzes

example json body:

{
	"createdBy": "Kulothungan",
	"title": "Python Programming",
	"questions": [
		{
			"text": "What is str?",
			"correctOptionIdx": 0,
			"options": ["string", "integer", "dict", "set"]
		},
		{
			"text": "What is dict?",
			"correctOptionIdx": 2,
			"options": ["string", "integer", "dict", "set"]
		}
	]
}

example response of the request:

{
	"message": "Quiz created successfully",
	"quidId": 89754522,
}

GET: /api/v1/quizzes/{quiz_id}

example response of the request:

{
	"id": 89754522,
	"createdAt": "2023-10-05T21:39:17.397343371+05:30",
	"title": "Python Programming",
	"createdBy": "Kulothungan",
	"questions": [
		{
			"id": 397813821,
			"quizId": 89754522,
			"options": [
				{
					"id": 635011239,
					"questionId": 397813821,
					"text": "dict"
				},
				{
					"id": 2049870362,
					"questionId": 397813821,
					"text": "string"
				},
				{
					"id": 2724491244,
					"questionId": 397813821,
					"text": "set"
				},
				{
					"id": 3559821882,
					"questionId": 397813821,
					"text": "integer"
				}
			],
			"text": "What is str?"
		},
		{
			"id": 3766009826,
			"quizId": 89754522,
			"options": [
				{
					"id": 202646390,
					"questionId": 3766009826,
					"text": "integer"
				},
				{
					"id": 1067323032,
					"questionId": 3766009826,
					"text": "string"
				},
				{
					"id": 1419749967,
					"questionId": 3766009826,
					"text": "dict"
				},
				{
					"id": 3492017362,
					"questionId": 3766009826,
					"text": "set"
				}
			],
			"text": "What is dict?"
		}
	]
}

POST: /api/v1/submissions

example json body request

{
	"answeredBy": "Rishvan",
	"quizId": 89754522,
	"answers": [
		{
			"questionId": 397813821,
			"optionId": 2049870362
		},
		{
			"questionId": 3766009826,
			"optionId": 1419749967
		}
	]
}

response

{
	"message": "Answer submitted successfully",
	"score": 0
}

GET: /api/v1/submissions/{quiz_id}

example request of the request:

{
	"submissions": [
		{
			"id": 1,
			"quizId": 89754522,
			"score": 1,
			"answeredBy": "Rish",
			"answeredAt": "0001-01-01T00:00:00Z"
		},
		{
			"id": 2,
			"quizId": 89754522,
			"score": 1,
			"answeredBy": "Risdfgh",
			"answeredAt": "0001-01-01T00:00:00Z"
		},
		{
			"id": 3,
			"quizId": 89754522,
			"score": 2,
			"answeredBy": "Risdfgh",
			"answeredAt": "0001-01-01T00:00:00Z"
		},
		{
			"id": 4,
			"quizId": 89754522,
			"score": 0,
			"answeredBy": "Risdfgh",
			"answeredAt": "0001-01-01T00:00:00Z"
		}
	]
}

Languages

  • Go 99.1%
  • Makefile 0.9%