You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 27, 2020. It is now read-only.
There are two types of middleware that should be easily definable with Yoga:
"HTTP" middleware: most probably express middlewares
GraphQL middleware: a function to be run before (or after) a resolver is executed
middlewares should be definable at every level (globally, type-level, field-level)
Current state:
HTTP middleware: Only possible by ejecting
GraphQL middleware: Only possible by ejecting (eg: using graphql-middleware)
Ideally, both HTTP middlewares and GraphQL middlewares should be definable without having to eject.
Unfortunately, because Yoga doesn't require a server to be defined by default, users have no way to access the underlying components.
Fortunately, for GraphQL middlewares, this can be done on the schema layer and thus should be handled by nexus (Proposal here: Support middleware graphql-nexus/nexus#64)
For HTTP middlewares however, we need to find an elegant way to expose the underlying express instance for people to compose with it
Thanks for this @Weakky! I'm very curious to see graphql middlewares support without ejecting soon. Until then, I'll simply eject (since it's a reversible process 😄 )
Would be great if someone clarified how Prisma 2, Yoga 2 and Prisma Nexus are or will be related 😓
I'm kinda lost here. There are so many moving parts changing as I'm typing it.
Description
There are two types of middleware that should be easily definable with Yoga:
express
middlewaresCurrent state:
graphql-middleware
)Ideally, both HTTP middlewares and GraphQL middlewares should be definable without having to eject.
Unfortunately, because Yoga doesn't require a server to be defined by default, users have no way to access the underlying components.
nexus
(Proposal here: Support middleware graphql-nexus/nexus#64)express
instance for people to compose with itMotivation
Obvious use-cases:
Some ideas
Accessing the underlying
express
instanceOption 1
Have an
express
folder, in which all files gets the underlying express instance injectedOption 2
Do we really need several files in a folder? What about a single
express.ts
file ?Option 3
Any better idea?
Because HTTP middlewares and GraphQL middlewares are two different concepts, it feels hard to come up with an API that elegantly conciles the two.
We'd love to hear feedback/different API design for express middlewares as well as nexus middlewares 🙌
Thanks!
The text was updated successfully, but these errors were encountered: