mirror of
https://github.com/fastapi/fastapi.git
synced 2026-10-20 17:05:21 -04:00
✨ Add docs for GraphQL (#48)
This commit is contained in:
1 parent
bf53518141
commit
984dd71d13
4 files changed
+59
No files matched your search
@@ -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)))
|
||||
Reference in new issue
Block a user