mirror of
https://github.com/Xevion/trivia.git
synced 2025-12-10 18:08:56 -06:00
rem config.py, basic scores data, api and basic routes
This commit is contained in:
@@ -2,4 +2,29 @@
|
|||||||
api.py
|
api.py
|
||||||
|
|
||||||
Handles backend routes assisting
|
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
16
trivia/data/scores.json
Normal 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
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -2,4 +2,16 @@
|
|||||||
routes.py
|
routes.py
|
||||||
|
|
||||||
Handles user frontend routes.
|
Handles user frontend routes.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from trivia import app
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/")
|
||||||
|
def index():
|
||||||
|
"""
|
||||||
|
Handles the frontend user index.
|
||||||
|
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
return 'index'
|
||||||
|
|||||||
Reference in New Issue
Block a user