Starlite
Strawberry comes with an integration for
Starlite by providing a
make_graphql_controller
function that can be used to create a GraphQL
controller.
See the example below for integrating Starlite with Strawberry:
Options
The make_graphql_controller
function accepts the following options:
-
schema
: mandatory, the schema created bystrawberry.Schema
. -
path
: optional, defaults to “, the path where the GraphQL endpoint will be mounted. -
graphql_ide
: optional, defaults to"graphiql"
, allows to choose the GraphQL IDE interface (one ofgraphiql
,apollo-sandbox
orpathfinder
) or to disable it by passingNone
. -
allow_queries_via_get
: optional, defaults toTrue
, whether to enable queries viaGET
requests -
context_getter
: optional Starlite dependency for providing custom context value. -
root_value_getter
: optional Starlite dependency for providing custom root value. -
debug
: optional, defaults toFalse
, whether to enable debug mode. -
keep_alive
: optional, defaults toFalse
, whether to enable keep alive mode for websockets. -
keep_alive_interval
: optional, defaults to1
, the interval in seconds for keep alive messages.
context_getter
The context_getter
option allows you to provide a custom context object that
can be used in your resolver. It receives a request
object that can be used to
extract information from the request.
root_value_getter
The root_value_getter
option allows you to provide a custom root value that
can be used in your resolver. It receives a request
object that can be used to
extract information from the request.