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!
- Clone this repository:
git clone $repo_link
- Go to the repository folder:
cd $repo_name
- Done!
With Docker
- Create a docker image
docker build -t quiz-docker -f Dockerfile .
- Run the image
docker run -it -p 8888:8888 quiz-docker
- Done!
Without Docker
- Create and initiate a local environment:
python -m venv venv
source venv/bin/activate
- Install the required dependencies (the next command uses pip. Use the one you like):
pip install -r requirements.txt
- Make migrations and migrate
./manage.py makemigrations
./manage.py migrate
- Run the server
gunicorn core.wsgi:application --bind 0.0.0.0:8888
- Done!
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/
Entity–Relationship Model:
default admin:
{
"email": "admin@mail.com",
"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.