apt install python3
pip3 install Flask Flask-SQLAlchemy SQLAlchemy
pip3 install numpy
python3 controller.py
- create database model:
python3 controller.py
- (kill
python3 controller.py
/ CTLR+C) - preload activity / category / quiz schema data:
python3 src/preload_quiz.py
- load quiz answers example (category 0 only: data/test.sh)
curl -X POST localhost:5000/users -H 'Content-Type: application/json' -d '{"username": "andrea", "email": "andrea"}'
curl -X POST localhost:5000/users -H 'Content-Type: application/json' -d '{"username": "elias", "email": "elias"}'
curl -X POST localhost:5000/quiz/1 -H 'Content-Type: application/json' -d @risposte_andrea.json
curl -X POST localhost:5000/quiz/2 -H 'Content-Type: application/json' -d @risposte_elias.json
curl localhost:5000/distance
Lists all users.
GET /users
Lists single user specified by "id".
GET /users/<id>
Create new user with payload json data.
POST /users
Example json:
{ "username": "andrea", "email": "andrea"}
GET /activity
GET /category
GET /quiz
Create a new quiz answer for user specified by "id" with payload json data.
POST /quiz/<user_id>
Example json:
[ { "question": "Sono in grado di chiudere gli occhi e raffigurarmi oggetti, luoghi o avvenimenti", "risposta": "4", "id": "0" }, { "question": "Leggo più facilmente cartine, tabelle e diagrammi piuttosto che indicazioni scritte", "risposta": "4", "id": "1" } ]
Return the top x "top" users nearest to the user specified by "id".
GET /distance/<user_id>/<top>