Open LSafer opened 2 years ago
I believe graphql doesn't need a plugin. Instead, it needs a routing extension just like the get and post extensions.
get
post
For example:
fun Route.configureGraphql() { route("/graphql") { graphqlPlayground() graphql { wrapErrors = true schema { firstSchema() secondSchema() thierdSchema() firstRootSchema() secondRootSchema() thierdRootSchema() } } } }
This way we don't need the wrapWith: {...} and endpoint: String and playground: Boolean arguments in the configuration object. And gives us more flexibility and control over handling execution exceptions.
wrapWith: {...}
endpoint: String
playground: Boolean
I made a library/utility implementing this design
https://github.com/lsafer/kgraphql-ktor
In this library I implemented the described design. Additionally, I fixed serialization issues and error handling.
I believe graphql doesn't need a plugin. Instead, it needs a routing extension just like the
get
andpost
extensions.For example:
This way we don't need the
wrapWith: {...}
andendpoint: String
andplayground: Boolean
arguments in the configuration object. And gives us more flexibility and control over handling execution exceptions.I made a library/utility implementing this design
https://github.com/lsafer/kgraphql-ktor
In this library I implemented the described design. Additionally, I fixed serialization issues and error handling.