Skip to content

AndreyCorelli/aws-quizless

Repository files navigation

For getting help with Terraform check this page.

1 Groundwork

Setup virtual environment for the specific Python version (3.10):

pyenv local 3.9
virtualenv venv -p python3.9
source venv/bin/activate

Install the dependencies:

pip install fastapi
pip install redis
pip install uvicorn
pip freeze > requirements.txt

Test the API:

curl -iX 'GET' 'http://localhost:8055/api/quiz-topics'

Setup Git repository in the current project folder:

git init .
git remote add origin git@github.com:<username>/quizless.git

2 Quiz Backend

Test starting the quiz:

curl -iX 'POST' 'http://localhost:8055/api/quiz-start' \
  -H "Content-Type: application/json" \
  -d '{"topic_id": "d729af45-5ed3-42d0-ac57-d4485b64b067", "user_name": "Alph"}'

Test joining the quiz (quiz_code is taken from the previous command output):

curl -iX 'POST' 'http://localhost:8055/api/quiz-join' \
  -H "Content-Type: application/json" \
  -d '{"quiz_code": 68571, "user_name": "Bart"}'

Test getting the quiz status:

  • both quiz_code and user_token are taken either from /quiz-start or /quiz-join response.
curl -iX 'POST' 'http://localhost:8055/api/quiz-check-status' \
  -H "Content-Type: application/json" \
  -d '{"quiz_code": 68571, "user_token": "07d76bbd-51f6-4b7f-9d7a-59a6287c0a36"}'

Test Lambda

... with this JSON:

[{
  "body": "{\"requested_operation\":\"quiz-topics\"}"
}
,
{
  "body": "{\"requested_operation\":\"quiz-start\", \"payload\": {\"topic_id\": \"73b445cc-34c6-482d-bf44-0db2f3a06e05\", \"user_name\": \"Alph\"}}"
}]
{
 "requested_operation":"quiz-topics"
}
{
  "requested_operation":"quiz-start", 
  "payload": {"topic_id": "73b445cc-34c6-482d-bf44-0db2f3a06e05", "user_name": "Alph"}
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published