Use Graphiql with the Explorer plugin for the query builder

This commit is contained in:
Syer10
2023-03-31 19:09:32 -04:00
parent bce76bbcf3
commit d4599c3331
2 changed files with 77 additions and 61 deletions

View File

@@ -25,18 +25,10 @@ object GraphQLController {
}
fun playground(ctx: Context) {
val playgroundHtml = javaClass.getResource("/graphql-playground.html")
val body = playgroundHtml.openStream().bufferedReader().use { reader ->
val graphQLEndpoint = "graphql"
val subscriptionsEndpoint = "graphql"
val body = javaClass.getResourceAsStream("/graphql-playground.html")!!.bufferedReader().use { reader ->
reader.readText()
.replace("\${graphQLEndpoint}", graphQLEndpoint)
.replace("\${subscriptionsEndpoint}", subscriptionsEndpoint)
}
ctx.html(body ?: "Could not load playground")
ctx.html(body)
}
fun webSocket(ws: WsConfig) {