diff --git a/kgraphql-ktor/src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt b/kgraphql-ktor/src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt index bc7d5d08..471a9e2f 100644 --- a/kgraphql-ktor/src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt +++ b/kgraphql-ktor/src/main/kotlin/com/apurebase/kgraphql/KtorFeature.kt @@ -46,6 +46,17 @@ class GraphQL(val schema: Schema) { companion object Feature: ApplicationFeature { override val key = AttributeKey("KGraphQL") + private val rootFeature = FeatureInstance("KGraphQL") + + override fun install(pipeline: Application, configure: Configuration.() -> Unit): GraphQL { + return rootFeature.install(pipeline, configure) + } + } + + class FeatureInstance(featureKey: String = "KGraphQL"): ApplicationFeature { + + override val key = AttributeKey(featureKey) + override fun install(pipeline: Application, configure: Configuration.() -> Unit): GraphQL { val config = Configuration().apply(configure) val schema = KGraphQL.schema { @@ -121,6 +132,8 @@ class GraphQL(val schema: Schema) { } }) }.toString() + } + }