wanderhome-quiz/server/app/views.py

23 lines
527 B
Python
Raw Normal View History

2022-08-24 15:55:53 +01:00
from .tools.data import check_file, load, render_questions
from flask import Blueprint
from flask.helpers import abort
views = Blueprint(
name='views',
import_name=__name__
)
@views.route('/fetch/<string:data_type>/')
def _fetch(data_type):
if not check_file(f'{data_type}.json'): return abort(404)
if data_type == 'questions': return render_questions()
return load(f'{data_type}.json')
@views.route('/submit', methods=['POST'])
def _submit():
pass
@views.route('/results')
def _results():
pass