✨ Add docs for GraphQL (#48)

This commit is contained in:
Sebastián Ramírez authored and GitHub committed 2019-02-20 21:58:26 +04:00
1 parent bf53518141
commit 984dd71d13
4 files changed
+59

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
import graphene
from fastapi import FastAPI
from starlette.graphql import GraphQLApp
class Query(graphene.ObjectType):
hello = graphene.String(name=graphene.String(default_value="stranger"))
def resolve_hello(self, info, name):
return "Hello " + name
app = FastAPI()
app.add_route("/", GraphQLApp(schema=graphene.Schema(query=Query)))