Skip to content

Instantly share code, notes, and snippets.

@shaungehring
Created February 5, 2020 14:17
Show Gist options
  • Save shaungehring/e05287c2d798ff064b13b5e3329c78c1 to your computer and use it in GitHub Desktop.
Save shaungehring/e05287c2d798ff064b13b5e3329c78c1 to your computer and use it in GitHub Desktop.
app = Flask(__name__)
@app.route("/", methods=["GET"])
def graphql_playgroud():
return PLAYGROUND_HTML, 200
@app.route("/", methods=["POST"])
def graphql_server():
data = request.get_json()
success, result = graphql_sync(
schema,
data,
context_value=request,
debug=app.debug
)
status_code = 200 if success else 400
return jsonify(result), status_code
if __name__ == "__main__":
app.run(debug=True, host="0.0.0.0", port=8300)
docker-compose.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment