diff --git a/Profiles/ProfilesAPI.py b/Profiles/ProfilesAPI.py new file mode 100644 index 0000000..4467047 --- /dev/null +++ b/Profiles/ProfilesAPI.py @@ -0,0 +1,7 @@ +# Profile API here +from flask import Blueprint +import sys +from db import db +sys.path.append("../") + +profiles_api = Blueprint("profiles", __name__) diff --git a/Profiles/__pycache__/ProfilesAPI.cpython-38.pyc b/Profiles/__pycache__/ProfilesAPI.cpython-38.pyc new file mode 100644 index 0000000..f47262d Binary files /dev/null and b/Profiles/__pycache__/ProfilesAPI.cpython-38.pyc differ diff --git a/Scores/ScoresAPI.py b/Scores/ScoresAPI.py new file mode 100644 index 0000000..747798a --- /dev/null +++ b/Scores/ScoresAPI.py @@ -0,0 +1,7 @@ +# Score API here +from flask import Blueprint +import sys +from db import db +sys.path.append("../") + +scores_api = Blueprint("scores", __name__) diff --git a/Scores/__pycache__/ScoresAPI.cpython-38.pyc b/Scores/__pycache__/ScoresAPI.cpython-38.pyc new file mode 100644 index 0000000..d947c15 Binary files /dev/null and b/Scores/__pycache__/ScoresAPI.cpython-38.pyc differ diff --git a/__pycache__/db.cpython-38.pyc b/__pycache__/db.cpython-38.pyc new file mode 100644 index 0000000..1970f42 Binary files /dev/null and b/__pycache__/db.cpython-38.pyc differ diff --git a/db.py b/db.py new file mode 100644 index 0000000..777200b --- /dev/null +++ b/db.py @@ -0,0 +1,11 @@ +# Simulated db +db = [{ + "name": "Nobel", + "scores": [1, 2, 3, 4, 5] +}, { + "name": "Richard", + "scores": [5, 4, 3, 2, 1] +}, { + "name": "Hui Hui", + "scores": [9, 29, 34] +}] diff --git a/main.py b/main.py new file mode 100644 index 0000000..fc1adc3 --- /dev/null +++ b/main.py @@ -0,0 +1,16 @@ +from Scores.ScoresAPI import scores_api +from Profiles.ProfilesAPI import profiles_api +from flask import Flask +from db import db + + +# Write your flask code here + +app = Flask(__name__) + +app.register_blueprint(profiles_api, url_prefix="/profiles") +app.register_blueprint(scores_api, url_prefix="/users") + + +if __name__ == "__main__": + app.run("0.0.0.0", port=8080)