Skip to content

Instantly share code, notes, and snippets.

@nderkach
Last active November 26, 2017 12:04
Show Gist options
  • Save nderkach/ebd60ac9c3cf2d6f7a74f2e412e8d7a0 to your computer and use it in GitHub Desktop.
Save nderkach/ebd60ac9c3cf2d6f7a74f2e412e8d7a0 to your computer and use it in GitHub Desktop.
A simple Flask app serving GraphQL API
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