Hi all,
I'm learning Kotlin + Ktor + Graphql by following this
tutorial.
However, when I run the server and visit
http://localhost:8080/graphql I do not see the graphql playground š¤
Here's what I did so far:
⢠created the project using the project builder on
ktor.io
⢠added the kgraphql_version in gradle.properties
⢠updated the build.gradle.kts with the line mentioned in the tutorial
⢠in the tutorial
src/Application.kt
is mentioned but my automatically generated
Application.kt
file is under
src/main/kotlin/com.ryanzidago/Application.kt
š¤
Here's the content of my
Application.kt
package com.ryanzidago
import io.ktor.server.engine.*
import io.ktor.server.netty.*
import com.ryanzidago.plugins.*
import io.ktor.application.Application
import io.ktor.application.install
import com.apurebase.kgraphql.GraphQL
fun main() {
embeddedServer(Netty, port = 8080, host = "0.0.0.0") {
configureRouting()
}.start(wait = true)
}
fun Application.module(testing: Boolean = false) {
install(GraphQL) {
playground = true
schema {
query("hello") {
resolver { -> "World" }
}
}
}
}
Intellij tells me that there is a problem with the
install
(Not enough information to infer type variable B) and
playground
(Variable expected) but I cannot figure out what is wrong š¤
When I type
gradle --version
in my project root I get the following output:
ariviv
⯠gradle --version
------------------------------------------------------------
Gradle 7.3.3
------------------------------------------------------------
Build time: 2021-12-22 12:37:54 UTC
Revision: 6f556c80f945dc54b50e0be633da6c62dbe8dc71
Kotlin: 1.5.31
Groovy: 3.0.9
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 17.0.1 (Oracle Corporation 17.0.1+12-39)
OS: Linux 5.4.0-94-generic amd64
Any tips?