Created
March 9, 2019 08:37
-
-
Save tsunammis/786baf25f1ed2ee1c6dc89ab9d3351f2 to your computer and use it in GitHub Desktop.
Introducing Tartiflette: dailymotion's Open Source GraphQL Implementation for Python 3.6+
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
import asyncio | |
from tartiflette import Engine, Resolver | |
@Resolver("Query.hello") | |
async def resolver_hello(parent, args, ctx, info): | |
return "hello " + args["name"] | |
async def run(): | |
ttftt = Engine(""" | |
type Query { | |
hello(name: String): String | |
} | |
""") | |
result = await ttftt.execute( | |
query='query { hello(name: "Chuck") }' | |
) | |
print(result) | |
# {'data': {'hello': 'hello Chuck'}} | |
if __name__ == "__main__": | |
loop = asyncio.get_event_loop() | |
loop.run_until_complete(run()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment