rem config.py, basic scores data, api and basic routes

This commit is contained in:
Xevion
2020-06-19 16:02:27 -05:00
parent aaf476d256
commit 368f6130ec
4 changed files with 55 additions and 2 deletions

View File

View File

@@ -2,4 +2,29 @@
api.py
Handles backend routes assisting
"""
"""
from flask import request
from trivia import app
@app.route("/api/changed")
@app.route("/api/changed/")
def changed():
"""
A simple substitute for the 304 Not Modified HTTP return.
:return True if data has changed since last
TODO: Remove this function once a proper 304 Not Modified implementation is found for client side.
"""
time = request.args.get('last')
@app.route("/api/refresh")
@app.route("/api/refresh/")
def refresh():
"""
Used for refreshing client-side table data. Returns a JSON response with all data necessary to build the table.
"""

16
trivia/data/scores.json Normal file
View File

@@ -0,0 +1,16 @@
[
{
"teamno" : 0,
"teamname" : "Example Team 1",
"scores" : [
1, 2, 3, 4
]
},
{
"teamno" : 1,
"teamname" : "Example Team 2",
"scores" : [
5, 6, 7, 8
]
}
]

View File

@@ -2,4 +2,16 @@
routes.py
Handles user frontend routes.
"""
"""
from trivia import app
@app.route("/")
def index():
"""
Handles the frontend user index.
:return:
"""
return 'index'