Skip to content

How to use middleware for all queries? #1182

@datamusee

Description

@datamusee

Hello

I'm trying to use middlewares to do logging and to manage authorization. But I doen't find how to configure a middleware.
I've a
class Query(ObjectType):
... here some fields definition...

then
schema = Schema(query=Query)
vfonc = GraphQLView.as_view('graphql', schema=schema, graphiql=True)
flask_app.add_url_rule('/graphql', view_func=vfonc)
...
and I've 2 middlewares build after the model here:
https://docs.graphene-python.org/en/latest/execution/middleware/
But, that page describe how to add a middleware when you directly call schema.execute, which is an action that I never do.

I've read a lot (graphene doc, stack overflow...)
I think that I've seen answers in the Django context, but not applicable in my context (Flask).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions