Brings prisma playground to Graphene and more
Project description
Graphene prisma
Brings prisma playground to graphene and more
Install
To install graphene_prisma
, you need to specify one of the supported frameworks
pip install graphene_prisma[framework]
or
pip install graphene_prisma
pip install framework
Supported frameworks :
e.g. starlette
pip install graphene_prisma[starlette]
Usage
To use graphene_prisma
from graphene_prisma.[framework] import [GraphQLHandler]
- [framework] : name of the framework (responder, starlette,...)
- [GraphQLHandler]: name of the graphql view in your framework (
GraphQLView
forresponder
andGraphQLApp
forstarlette
)
Here is a list of the graphql classes for each framework
framework | GraphQL view |
---|---|
responder | GraphQLView |
starlette | GraphQLApp |
Starlette
from starlette.applications import Starlette
from graphene_prisma.starlette import GraphQLApp
class Query(graphene.ObjectType):
hello = graphene.String(name=graphene.String(default_value="stranger"))
def resolve_hello(self, info, name):
return f"Hello {name}"
app = Starlette()
app.add_route('/', GraphQLApp(schema=graphene.Schema(query=Query)))
Responder
import responder
from graphene_prisma.responder import GraphQLView
api = responder.API()
class Query(graphene.ObjectType):
hello = graphene.String(name=graphene.String(default_value="stranger"))
def resolve_hello(self, info, name):
return f"Hello {name}"
schema = graphene.Schema(query=Query)
view = GraphQLView(api=api, schema=schema)
api.add_route("/graph", view)
api.run()
TODO
- Support other frameworks (django, flask,...)
- Tests
- Upload
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
graphene-prisma-0.1.0.tar.gz
(3.5 kB
view hashes)