mirror of
https://github.com/graphql-python/graphene.git
synced 2025-07-27 08:19:45 +03:00
Update middleware.rst
I think a description of where the Middleware needs to go to be executed every time would be useful. It would have saved me some time.
This commit is contained in:
parent
d728b84e48
commit
9327ef4d32
|
@ -41,6 +41,18 @@ And then execute it with:
|
|||
|
||||
result = schema.execute('THE QUERY', middleware=[AuthorizationMiddleware()])
|
||||
|
||||
Or set it up in the default middleware to be executed for every query in settings.py:
|
||||
|
||||
.. code:: python
|
||||
|
||||
GRAPHENE = {
|
||||
'SCHEMA': 'my_app.schema.schema'
|
||||
'MIDDLEWARE': (
|
||||
'graphene_django.debug.DjangoDebugMiddleware',
|
||||
'mymodule.AuthorizationMiddleware'
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Functional example
|
||||
------------------
|
||||
|
@ -69,3 +81,4 @@ And then execute it with:
|
|||
.. code:: python
|
||||
|
||||
result = schema.execute('THE QUERY', middleware=[timing_middleware])
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user