Anders and Briegel in Python
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
584B

  1. from flask import Flask, request, render_template, jsonify
  2. import abp
  3. graphstate = abp.GraphState()
  4. app = Flask(__name__)
  5. @app.route("/")
  6. def index():
  7. return render_template("index.html")
  8. @app.route("/state")
  9. def state():
  10. if request.method == "GET":
  11. return jsonify(graphstate.to_json())
  12. elif request.method == "POST":
  13. graphstate.from_json(request.data)
  14. return jsonify(graphstate.to_json())
  15. @app.route("/state")
  16. def state():
  17. return jsonify(graphstate.to_json())
  18. if __name__ == "__main__":
  19. app.debug = True
  20. app.run(host="0.0.0.0")