Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idea: Alternative design for integrating with ktor #190

Open
LSafer opened this issue Jun 16, 2022 · 0 comments
Open

Idea: Alternative design for integrating with ktor #190

LSafer opened this issue Jun 16, 2022 · 0 comments

Comments

@LSafer
Copy link

LSafer commented Jun 16, 2022

I believe graphql doesn't need a plugin. Instead, it needs a
routing extension just like the get and post extensions.

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.


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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant