Add /data/<key> to get value of certain key
This commit is contained in:
parent
46fc7a7a63
commit
2ba463c9dc
6
app.py
6
app.py
|
@ -23,6 +23,12 @@ def set_data_point(data_id):
|
|||
json.dump(data, f)
|
||||
return jsonify({"success": True})
|
||||
|
||||
@app.route("/data/<key>")
|
||||
def get_data_point(key):
|
||||
if key not in data:
|
||||
return jsonify({"success": False}), 404
|
||||
return jsonify({"success": True, "value": data[key]})
|
||||
|
||||
@app.route("/admin/")
|
||||
def admin():
|
||||
return render_template("admin.html", data=data)
|
||||
|
|
Loading…
Reference in New Issue