This code can be deployed in following two ways:-
git clone /~https://github.com/engineerakki/backend-test
pip3 install -r requirements.txt
python3 app.py
This should start the code server on port 8080
git clone /~https://github.com/engineerakki/backend-test
docker build -t backend-test .
docker run -itd -p 8080:8080 backend-test:latest
Perform an GET call on following endpoint:
http://localhost:8080/<userid>/login
e.g:
http://localhost:8080/100/login/
http://localhost:8080/101/login/
{
"100": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MTM0MDEwNDUsIm5iZiI6MTYxMzQwMTA0NSwianRpIjoiMjRjYzJlMTItYmU1Yi00NjJlLWE3ZmQtOWUwMmVmZDM0MmMxIiwiZXhwIjoxNjEzNDAxMTA1LCJpZGVudGl0eSI6MTAwLCJmcmVzaCI6ZmFsc2UsInR5cGUiOiJhY2Nlc3MifQ.9uzrz8LJ1w1vCdST8Swt3VbrmaHamjl1gn2jqFtu9Tg"
}
Note: This token is valid for 10 mins
http://localhost:8080/<<level_id>>/score?sessionkey=<<key_from_2.1>>
http://localhost:8080/1/score?sessionkey=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MTM0MTkyOTksIm5iZiI6MTYxMzQxOTI5OSwianRpIjoiNmUwOTM0NTMtZDJkNi00YTA0LTgyMDgtZjQwZmY4YzM1NTAyIiwiZXhwIjoxNjEzNDE5NTk5LCJpZGVudGl0eSI6MTAwLCJmcmVzaCI6ZmFsc2UsInR5cGUiOiJhY2Nlc3MifQ.uQJBKrB8rwRji47pCc7X02LJ5y51UYOdQdNw3wbEfQY
{
"score": 101
}
{
"status": "Score Updated for the user"
}
http://localhost:8080/<<levelid>>/highscorelist?sessionkey=<<key_from_2.1>>
http://localhost:8080/5/highscorelist?sessionkey=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MTM0MjE5NzcsIm5iZiI6MTYxMzQyMTk3NywianRpIjoiYTg5Yzc4NGEtYWUwZC00M2Y0LWJhODgtOGRhMDEzNGMyZDVmIiwiZXhwIjoxNjEzNDIyMjc3LCJpZGVudGl0eSI6NTAwLCJmcmVzaCI6ZmFsc2UsInR5cGUiOiJhY2Nlc3MifQ.jKb7-VOlEGq2tEg6dcv7lTAC52pe67VreJCG1UXqtos
{
"score": 202,
"user": 500
}
{ "score": 101, "user": 100 }
http://localhost:8080/get_user_model?sessionkey=<<key_from_2.1>>
{
"users": [
{
"level": 1,
"score": 5,
"userid": 100
},
{
"level": 2,
"score": 5,
"userid": 101
},
{
"level": 2,
"score": 5,
"userid": 100
},
{
"level": 1,
"score": 2,
"userid": 103
},
{
"level": 0,
"score": 0,
"userid": 500
},
{
"level": 5,
"score": 202,
"userid": 500
}
]
}