Replies: 3 comments 4 replies
-
@tobolleo It's going to depend, of course. If you're expecting to put security at a lower level than your controllers, you're probably not going to have a very easy time. However, if you're okay with security (auth/authz) existing primarily at the "controller" (resolver) level, you shouldn't have too much trouble.l I don't know what your code looks like, so you're going to have to translate what I'm saying into what makes sense for your framework. Effectively, you're going to want to have two different front controllers. If you don't know what those are, do some research. From the front controllers, you'll just pass the request to two different request handlers ( You're basically going to split off how the requests are handled at the front controller level. Then from there you'll route each request to two different groups of controllers/resolvers. |
Beta Was this translation helpful? Give feedback.
-
I'm also trying to have multiple GraphQL endpoints. In our current solution we have one .graphql file for each api: Since some types and operations are shared between this APIs, others are not, we can't just use different namespaces. I was thinking about something like an API annotation next to the Query / Mutation / Type / Input / Field annotations, where one could define the enabled apis for this type. What do you think? Maybe this is possible with a custom middleware? |
Beta Was this translation helpful? Give feedback.
-
Hey @oojacoboo, thank you for your answer! One basic example of what I want to accomplish is this:
I tried this with two schemas (different controller namespaces, same entity namespace), how ever the output looks like this: admin api: This looks good! type Mutation {
createPage(page: PageInput!): Page!
}
type Page {
id: Int!
title: String
}
input PageInput {
title: String
}
type Query {
findPages: [Page!]!
} public api: the "PageInput" should not be part of the api. type Mutation {
"""
A placeholder query used by thecodingmachine/graphqlite when there are no declared mutations.
"""
dummyMutation: String
}
type Page {
id: Int!
title: String
}
input PageInput {
title: String
}
type Query {
findPages: [Page!]!
} If the schema would automatically remove all types / inputs / unions / enums that are not used anywhere in the schema, I think the approach with different controller namespaces for each api could work, but I guess this is not planed / working? |
Beta Was this translation helpful? Give feedback.
-
Hi, I would like to continue in this discussion.
Based on that, I'm still not sure how should I achieve of two different separated instances of graphqlite. I need for them to have different security settings and non shared cache. Each with their own configuration file. You said it's possible to build two different APIs, so I assume that this is possible. Can you please provide me more detailed guide how to do this?
Thank you. @oojacoboo
Beta Was this translation helpful? Give feedback.
All reactions