|
|
@@ -10,20 +10,20 @@ def index(): |
|
|
|
return render_template("index.html") |
|
|
|
|
|
|
|
@app.route("/graph", methods=["GET", "POST"]) |
|
|
|
def graph(page): |
|
|
|
def graph(): |
|
|
|
if request.method == 'POST': |
|
|
|
# Convert the data to a graph state |
|
|
|
g = abp.GraphState() |
|
|
|
g.from_json(json.loads(data)) |
|
|
|
g.from_json(json.loads(request.data)) |
|
|
|
|
|
|
|
# Convert it back to JSON |
|
|
|
# Convert it back to JSON just for fun |
|
|
|
data = json.dumps(g.to_json(stringify=True)) |
|
|
|
|
|
|
|
# Insert into the database |
|
|
|
redis.execute_command("SET", "graph", data) |
|
|
|
|
|
|
|
# Return success |
|
|
|
return "OK" |
|
|
|
return "Posted {} bytes OK".format(len(data)) |
|
|
|
|
|
|
|
else: |
|
|
|
# Get from the database |
|
|
|