I don't know from graphql. Looking at the "Python server library" link on
graphql.org[1], it looks like you would define a graphene query class, and
then use it to respond to a JSON POST request[2]:
---------------------------------- %< ----------------------------------
import graphene
class Query(graphene.ObjectType):
hello = graphene.String()
def resolve_hello(self, args, context, info):
return 'Hello world!'
schema = graphene.Schema(query=Query)
@view_config(route_name='api_graphql', method='POST', renderer='json')
def api_graphql(request):
json_body = request.json_body
query = json_body['query']
variables = json_body.get('variables', {}
return schema.execute(query, variable_values=variables)
---------------------------------- %< ----------------------------------
[1]
https://graphql.org/code/#python
[2]
http://graphql.org/learn/serving-over-http/#post-request
Tres.
--
===================================================================
Tres Seaver
+1 540-429-0999 tse...@palladion.com
Palladion Software "Excellence by Design"
http://palladion.com