aPureBase / KGraphQL

Pure Kotlin GraphQL implementation
https://kgraphql.io
MIT License
298 stars 58 forks source link

Introduce a ktor feature #37 #79

Closed Allali84 closed 4 years ago

Allali84 commented 4 years ago

Hello @jeggy I implemented the solution that you designed using kotlinx.serialization I added a new module "example" as example of use tell me how you think about it :)

jeggy commented 4 years ago

This looks great 👍

I'm in the process of making the SchemaConfigurationDSL more extensible, so we can extend that one in here and have all ktor specific configuration under the same configuration DSL. But I think this will do for now 😃

When I'm finished with the new SchemaConfigurationDSL I will change it, so it will be like this instead:

fun Route.graphql(block: SchemaBuilder.() -> Unit) = route(GRAPHQL_ENDPOINT) {
....

// Usage:
graphql {
  configure {
    // Both core and ktor specific configuration will be available within this DSL block.
    context { call ->
      call.authentication.principal<User>()?.let {
        +it
      }
    }
  }
  ...
}