Skip to content

Commit 3c81e98

Browse files
authored
Update KGraphQL (#2292)
## Description Updates KGraphQL to the current Github repository, as aPureBase has discontinued maintenance (cf. https://github.com/aPureBase/KGraphQL?tab=readme-ov-file#disclaimer).
1 parent 0d5b216 commit 3c81e98

File tree

1 file changed

+12
-10
lines changed
  • src/code/language-support/java-kotlin-android/server

1 file changed

+12
-10
lines changed

src/code/language-support/java-kotlin-android/server/kgraphql.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
---
22
name: KGraphQL
3-
description: KGraphQL is a Kotlin implementation of GraphQL. It provides a rich DSL to set up the GraphQL schema.
4-
url: https://kgraphql.io/
5-
github: aPureBase/KGraphQL
3+
description: KGraphQL is a pure Kotlin implementation of a code-first GraphQL server with focus on a rich and easy-to-use DSL that leverages existing code to set up the schema.
4+
url: https://stuebingerb.github.io/KGraphQL/
5+
github: stuebingerb/KGraphQL
66
tags:
77
- tools-and-libraries
88
- backend
99
---
1010

11-
Here's an example on how to create a simple schema based on a kotlin data class plus a property resolver that gets applied onto your class.
11+
Here's an example of how to create a simple schema based on a Kotlin data class plus a property resolver that gets applied onto your class:
1212

1313
```kotlin
1414
data class Article(val id: Int, val text: String)
1515

16-
fun main() {
16+
suspend fun main() {
1717
val schema = KGraphQL.schema {
1818
query("article") {
1919
resolver { id: Int?, text: String ->
2020
Article(id ?: -1, text)
2121
}
2222
}
2323
type<Article> {
24-
property<String>("fullText") {
24+
property("fullText") {
2525
resolver { article: Article ->
2626
"${article.id}: ${article.text}"
2727
}
@@ -36,17 +36,19 @@ fun main() {
3636
fullText
3737
}
3838
}
39-
""").let(::println)
39+
""".trimIndent()).let(::println)
40+
41+
// {"data":{"article":{"id":5,"fullText":"5: Hello World"}}}
4042
}
4143
```
4244

4345
KGraphQL is using coroutines behind the scenes to provide great asynchronous performance.
4446

45-
See [KGraphQL docs](https://kgraphql.io/Installation/) for more in depth usage.
47+
See [KGraphQL docs](https://stuebingerb.github.io/KGraphQL/Installation/) for more in depth usage.
4648

4749
## Ktor Plugin
4850

49-
KGraphQL has a Ktor plugin which gives you a fully functional GraphQL server with a single [install](https://ktor.io/docs/zfeatures.html) function call. Example below shows how to set up a GraphQL server within Ktor and it will give you a [GraphQL Playground](https://github.com/graphql/graphql-playground) out of the box by entering `localhost:8080/graphql`.
51+
KGraphQL has a Ktor plugin which gives you a fully functional GraphQL server with a single [install](https://ktor.io/docs/server-plugins.html#install) function call. The example below shows how to set up a GraphQL server within Ktor and it will give you a [GraphQL IDE](https://github.com/graphql/graphiql/tree/main) out of the box by entering `localhost:8080/graphql`.
5052

5153
```kotlin
5254
fun Application.module() {
@@ -61,4 +63,4 @@ fun Application.module() {
6163
}
6264
```
6365

64-
You can follow the [Ktor tutorial](https://kgraphql.io/Tutorials/ktor/) to set up a KGraphQL server with ktor from scratch up.
66+
You can follow the [Ktor tutorial](https://stuebingerb.github.io/KGraphQL/Tutorials/ktor/) to set up a KGraphQL server with Ktor.

0 commit comments

Comments
 (0)