如何在石墨烯解析器之后使用中间件?

Gus*_*pes 5 python graphql graphene-python

在 Node 中使用 Graphql,您可以在解析器之前之后使用中间件,例如使用Prisma

在Python中,使用Graphene,我只能找到一种使用中间件的方法在解析器

有没有办法在Python中的解析器之后使用中间件?

fro*_*One 2

怎么样:

class SomeMiddleware(object):
    def resolve(self, next, root, info, **args):
        next_node = next(root, info, **args)
        ...logic...
        return next_node
Run Code Online (Sandbox Code Playgroud)