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
Is it possible to assign my middleware to a specific return type? Let's elaborate it using an example.
Example
I'm defining my schema in SDL (Schema Definition Language):
let schema = buildschema(`
schema {
query: RootQuery,
mutation: RootMutation
}
type service{...}
type notservice{...}
type RootQuery {
query1: service
query2: service
query3: notservice
}
type RootMutation{...}
`);
I want to execute my middleware when a service is returned, How can I do it?
Current Solution
The current way is to apply middleware one by one to every query which is returning service as result:
But this solution is not maintainable because if I later add another query(e.g. query4) with the same return type (i.e. service), I should again modify my code:
Problem
Is it possible to assign my middleware to a specific return type? Let's elaborate it using an example.
Example
I'm defining my schema in SDL (Schema Definition Language):
I want to execute my middleware when a
service
is returned, How can I do it?Current Solution
The current way is to apply middleware one by one to every query which is returning
service
as result:But this solution is not maintainable because if I later add another query(e.g.
query4
) with the same return type (i.e.service
), I should again modify my code:The text was updated successfully, but these errors were encountered: