This project was created to clone the kahoot game with the backend section.
There is somethings and tools that must be prepared and installed before starting the project.
1. Python
2. Visual Studio Code
3. Insomnia
4. Flask / Django
Create a project folder and a venv
folder within:
mkdir myproject
cd myproject
python3 -m venv venv
On Windows:
py -3 -m venv venv
If you needed to install virtualenv because you are on an older version of Python, use the following command instead:
virtualenv venv
Before you work on your project, activate the corresponding environment: On Windows:
venv\Scripts\activate
Within the activated environment, use the following command to install Flask:
pip install Flask
-
Able to register and login data for creator quiz
@app.route('/register', methods=["POST"]) def userRegister(): @app.route('/login', methods=["POST"]) def loginUser():
Password encode and decode for secure
def enkrip(string,move): def dekrip(string,move):
-
Able to create, delete and update Quiz.
@app.route('/quiz', methods=["POST"]) def createQuiz(): @app.route('/quizzes/<quizId>', methods = ["PUT", "GET", "DELETE"]) def deleteQuiz(quizId): @app.route('/quizzes/<quizId>', methods = ["PUT", "GET", "DELETE"]) def updateQuiz(quizId):
Insomnia JSON for new quiz
{ "quiz-id": 123, "quiz-name": "makers batch IV", "quiz-category": "fun fact", "question-list": [] }
-
Able to create. delete and update Question in Quiz
-
Join the game with username and game pin
@app.route('/game/join', methods=['POST']) def joinGame():
Insomnia JSON for join the game
{ "game-pin": 568929, "username": "clover" }
-
Submit answer for question
@app.route('/game/answer', methods=['POST']) def submitAnswer():
Insomnia JSON for submit answer
{ "answer": "C", "quiz-id": 123, "question-number": 1, "username": "aduh", "game-pin": 568929 }
-
View leader board for the Winner
@app.route('/game/leaderboard', methods = ["POST"]) def getLeaderboard():
Insomnia JSON for get leaderboard
{ "game-pin": 568929 }