webapp: fetch eligibility data on backend
We fetch the eligibility data from the backend for the area the user is currently viewing. We don't want to trigger the search when the user is zoomed out, it could be heavy on the backend CPU. Hence, we trigger the fetch after the user searched for his real address or reached a good-enough zoom level. The backend is currently returning a dummy answer.nin/deploy
parent
8fbad8b7b1
commit
6c8c3b138d
@ -1,7 +1,19 @@
|
||||
from flask import Flask, render_template
|
||||
from flask import Flask, request, render_template
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route("/", methods=['GET'])
|
||||
def getMap():
|
||||
return render_template("map.html")
|
||||
|
||||
@app.route("/eligdata", methods=['GET'])
|
||||
def getEligData():
|
||||
args = request.args
|
||||
if 'swx' in args and 'swy' in args and \
|
||||
'nex' in args and 'ney' in args:
|
||||
return { "buildings": [
|
||||
{"x": args['swx'], "y":args['swy'], "label": "dummy elig val" },
|
||||
{"x": args['nex'], "y":args['ney'], "label": "dummy elig val 2" }
|
||||
]}
|
||||
else:
|
||||
return "Missing coordinates", 400
|
||||
|
Loading…
Reference in New Issue