Skip to content

Commit

Permalink
docs: update mkdocs and align library-coordinates (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
mervyn-mccreight authored Oct 19, 2024
2 parents cc6efae + 92119b8 commit fcf1260
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 63 deletions.
31 changes: 16 additions & 15 deletions docs/content/Plugins/ktor.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@ server.

You first need to add the KGraphQL-ktor package to your dependency

```kotlin tab="Kotlin Gradle Script"
implementation("com.apurebase:kgraphql-ktor:$KGraphQLVersion")
```

```groovy tab="Gradle"
implementation 'com.apurebase:kgraphql-ktor:${KGraphQLVersion}'
```

```xml tab="Maven"
<dependency>
<groupId>com.apurebase</groupId>
<artifactId>kgraphql-ktor</artifactId>
<version>${KGraphQLVersion}</version>
</dependency>
```
=== "Kotlin Gradle Script"
```kotlin
implementation("de.stuebingerb:kgraphql-ktor:$KGraphQLVersion")
```
=== "Gradle"
```groovy
implementation 'de.stuebingerb:kgraphql-ktor:${KGraphQLVersion}'
```
=== "Maven"
```xml
<dependency>
<groupId>de.stuebingerb</groupId>
<artifactId>kgraphql-ktor</artifactId>
<version>${KGraphQLVersion}</version>
</dependency>
```

## Initial setup

Expand Down
64 changes: 22 additions & 42 deletions docs/content/Tutorials/ktor.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,65 +7,45 @@ The very first thing we'll be doing is creating a new IntelliJ project and use t
![](../assets/ktor-project-setup.png)

After this we'll press "Next" and fill out the necessary information and then press "Finish". Now we have a brand new
ktor project. Now we can add the dependencies needed to our `gradle.properties` and `build.gradle.kts` files.
ktor project.

=== "gradle.properties"
```properties
kgraphql_version=x.x.x
```
Now we can begin adding the needed dependencies.

Replace `x.x.x` with the latest
version [![Maven Central](https://img.shields.io/maven-central/v/com.apurebase/kgraphql.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.apurebase%22%20AND%20a:%22kgraphql%22).
version [![Maven Central](https://img.shields.io/maven-central/v/de.stuebingerb/kgraphql.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22de.stuebingerb%22%20AND%20a:%22kgraphql%22).

=== "Kotlin Gradle Script"
```kotlin
val ktor_version: String by project
val kotlin_version: String by project
val logback_version: String by project
val kgraphql_version: String by project // <-- Add this line

...

```kotlin
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version")
implementation("io.ktor:ktor-server-netty:$ktor_version")
implementation("ch.qos.logback:logback-classic:$logback_version")
implementation("com.apurebase:kgraphql:$kgraphql_version") // <-- Add these two lines
implementation("com.apurebase:kgraphql-ktor:$kgraphql_version") // <-- Add these two lines
testImplementation("io.ktor:ktor-server-tests:$ktor_version")
implementation("de.stuebingerb:kgraphql:x.x.x")
implementation("de.stuebingerb:kgraphql-ktor:x.x.x")
}
```

=== "Gradle"
```groovy
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "io.ktor:ktor-server-netty:$ktor_version"
implementation "ch.qos.logback:logback-classic:$logback_version"
implementation "com.apurebase:kgraphql:$kgraphql_version" // <-- Add these two lines
implementation "com.apurebase:kgraphql-ktor:$kgraphql_version" // <-- Add these two lines
testImplementation "io.ktor:ktor-server-tests:$ktor_version"
}
```
```groovy
dependencies {
implementation "de.stuebingerb:kgraphql:x.x.x"
implementation "de.stuebingerb:kgraphql-ktor:x.x.x"
}
```

The only thing left is installing the GraphQL feature onto our server by opening `src/Application.kt` and use these
lines as the `Application.module` function

=== "Application.kt"

```kotlin
fun Application.module(testing: Boolean = false) {
install(GraphQL) {
configureRouting()
playground = true
schema {
query("hello") {
resolver { -> "World" }
```kotlin
fun Application.module(testing: Boolean = false) {
install(GraphQL) {
configureRouting()
playground = true
schema {
query("hello") {
resolver { -> "World" }
}
}
}
}
}
```
```

Now we have a fully functional GraphQL Server and we can startup our server by pressing the green play icon beside the
`main` function.
Expand Down
2 changes: 1 addition & 1 deletion docs/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3.7'

services:
docs:
image: squidfunk/mkdocs-material:5.3.2
image: squidfunk/mkdocs-material:9.5.41
entrypoint: [ ]
command: sh -c "pip3 install --user -r requirements.txt && mkdocs serve --dev-addr=0.0.0.0:8000"
volumes:
Expand Down
3 changes: 2 additions & 1 deletion docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ markdown_extensions:
- pymdownx.smartsymbols
- pymdownx.superfences
- pymdownx.tasklist
- pymdownx.tabbed
- pymdownx.tabbed:
alternate_style: true
- pymdownx.snippets:
check_paths: true
- toc:
Expand Down
8 changes: 4 additions & 4 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mkdocs==1.1.2
pymdown-extensions==10.0
mkdocs==1.6.1
pymdown-extensions==10.11.2
mkdocs-bootswatch==1.1
mkdocs-material==5.3.2
markdown-include==0.5.1
mkdocs-material==9.5.41
markdown-include==0.8.1
mkdocs-exclude==1.0.2

0 comments on commit fcf1260

Please sign in to comment.