kopia lustrzana https://github.com/cirospaciari/socketify.py
add mutations to graphiql
rodzic
e000162277
commit
29cafd0414
|
@ -21,5 +21,7 @@ class Query:
|
|||
app = App()
|
||||
app.get("/", lambda res, req: res.end(strawberry.utils.graphiql.get_graphiql_html()))
|
||||
app.post("/", graphiql_from(Query))
|
||||
# you can also pass an Mutation as second parameter
|
||||
# app.post("/", graphiql_from(Query, Mutation))
|
||||
app.listen(3000, lambda config: print("Listening on port http://localhost:%d now\n" % config.port))
|
||||
app.run()
|
|
@ -1,8 +1,11 @@
|
|||
import strawberry
|
||||
import strawberry.utils.graphiql
|
||||
|
||||
def graphiql_from(Query):
|
||||
schema = strawberry.Schema(Query)
|
||||
def graphiql_from(Query, Mutation=None):
|
||||
if Mutation:
|
||||
schema = strawberry.Schema(query=Query, mutation=Mutation)
|
||||
else:
|
||||
schema = strawberry.Schema(Query)
|
||||
|
||||
async def post(res, req):
|
||||
# we can pass whatever we want to context, query, headers or params, cookies etc
|
||||
|
|
Ładowanie…
Reference in New Issue