Created
February 5, 2020 14:17
-
-
Save shaungehring/e05287c2d798ff064b13b5e3329c78c1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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