Last active
November 26, 2017 12:04
-
-
Save nderkach/ebd60ac9c3cf2d6f7a74f2e412e8d7a0 to your computer and use it in GitHub Desktop.
A simple Flask app serving GraphQL API
This file contains hidden or 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
from flask import Flask | |
from schema import Query | |
from flask_graphql import GraphQLView | |
from graphene import Schema | |
import os | |
view_func = GraphQLView.as_view( | |
'graphql', schema=Schema(query=Query), graphiql=True) | |
app = Flask(__name__) | |
app.add_url_rule('/graphql', view_func=view_func) | |
if __name__ == '__main__': | |
app.run(host='0.0.0.0', port=os.environ.get('PORT', 5000)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment