tot-ra / graphql-schema-registry

GraphQL schema registry
MIT License
372 stars 68 forks source link

Using Graphql-middleware with example gateway #173

Open mdettelson opened 2 years ago

mdettelson commented 2 years ago

Hi there!

I am currently using this registry with the example managed gateway provided in the examples directory. I'd like to apply a GraphQL middleware (for authorization purposes) at the gateway level, but I have yet to find a place in the custom gateway code to apply my middleware to the schema. Would someone be able to point me in the right direction?

Thanks!

tot-ra commented 2 years ago

hey @mdettelson, you're right, after 5.0.0 examples got simplified and use only apollo server directly. Previously, in 4.x.x versions, apollo server was wrapped into express. So that handler could intercept request context, check for cookies or headers and validate access.

https://github.com/pipedrive/graphql-schema-registry/blob/4.0.0/examples/gateway_service_managed_federation/index.js#LL49C33-L49C51

If you manage to bring it back, do share an example for others too :)