Adds GraphQL support to your WebPy application.
Just use the GraphQLView
view from webpy_graphql
from webpy_graphql import GraphQLView
urls = ("/graphql", "GQLGateway")
app = web.application(urls, globals())
class GQLGateway(GraphQLView):
class GraphQLMeta:
schema=Schema
This will add /graphql
endpoints to your app (GET and POST methods implemented in the class GraphQLView).
schema
: TheGraphQLSchema
object that you want the view to execute when it gets a valid request.context
: A value to pass as thecontext
to thegraphql()
function.root_value
: Theroot_value
you want to provide toexecutor.execute
.pretty
: Whether or not you want the response to be pretty printed JSON.executor
: TheExecutor
that you want to use to execute queries.graphiql
: IfTrue
, may present GraphiQL when loaded directly from a browser (a useful tool for debugging and exploration).batch
: Set the GraphQL view as batch (for using in Apollo-Client or ReactRelayNetworkLayer)graphiql_temp_title
: Set template title for GraphiQL