Skip to content

restful API for a Quiz game with ranking system

License

Notifications You must be signed in to change notification settings

leonardomlouzas/quiz-API

 
 

Repository files navigation

Quiz API

This is a restful API for a quiz game. The user must complete quizzes consisted of various questions to earn points and achieve the first place in the rank!


Installation

  1. Clone this repository:
git clone $repo_link
  1. Go to the repository folder:
cd $repo_name
  1. Done!

Usage

With Docker

  1. Create a docker image
docker build -t quiz-docker -f Dockerfile .
  1. Run the image
docker run -it -p 8888:8888 quiz-docker
  1. Done!

Without Docker

  1. Create and initiate a local environment:
python -m venv venv
source venv/bin/activate
  1. Install the required dependencies (the next command uses pip. Use the one you like):
pip install -r requirements.txt
  1. Make migrations and migrate
./manage.py makemigrations
./manage.py migrate
  1. Run the server
gunicorn core.wsgi:application --bind 0.0.0.0:8888
  1. Done!

Routes

Game

Play

[GET, POST]
/api/play/$category_id/

Ranking

[GET]
/api/ranking/

Users

Login

[POST]
/api/login/

Register

[POST]
/api/register/

List All

[GET]
/api/users/

Retrieve

[GET]
/api/users/$user_id/

Quiz

List and Create

[GET, POST]
/api/quizzes/

Retrieve, Edit and Delete

[GET, POST, PATCH, DELETE]
/api/quizzes/$quiz_id/

Categories

List and Create

[GET, POST]
/api/categories/

Retrieve, Edit and Delete

[GET, POST, PATCH, DELETE]
/api/categories/$category_id/

Questions

List and Create

[GET, POST]
/api/questions/

Retrieve, Edit and Delete

[GET, POST, PATCH, DELETE]
/api/questions/$question_id/

Notes

Entity–Relationship Model:

Entity–relationship model

default admin:

{
  "email": "[email protected]",
  "password": "P4ssw0rD"
}

If you are not using docker, you need to run the create_admin.py before using the default admin:

./manage.py create_admin

  • The Postman collection is in the repository root folder, it is complete with all the available routes.

About

restful API for a Quiz game with ranking system

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.0%
  • Dockerfile 1.0%