Comments (7)
I'm sorry, I got confused
Found what I needed here - https://github.com/jeggy/ktorgraphql/blob/master/src/GraphQLRequest.kt
from kgraphql.
how are you calling .execute()
?
Passing variables is split into 2 different arguments.
Here's an example:
val dollarSign = '$'
val query = """
query(${dollarSign}id: Int! = 6){
TruckLoad(id: ${dollarSign}id) {
id
TruckLoad{
id
}
}
}""".trimIndent()
val variables = """
{
"id": 5
}
""".trimIndent()
val res = schema.execute(query, variables)
println(res)
from kgraphql.
Using ktor:
routing {
route("/graphql") {
post {
val request = call.receive<GraphQLRequest>()
val query = request.query
val context: ThetaContext by inject()
val sch = ThetaSchema(context)
val result = sch.schema.execute(query)
call.respondText(result, io.ktor.http.ContentType.Application.Json)
}
}
}
from kgraphql.
I'm planning to do a module for ktor, so in the feature you would just install KGraphQL into ktor something like this:
embeddedServer(...) {
install(KGraphQL)
}
But for for you could take a look at this project: https://github.com/jeggy/ktorgraphql/blob/master/src/Application.kt#L55
from kgraphql.
I think I saw a PR or something about that in ktor's project. do you have a link?
from kgraphql.
I've seen some that are using the java implementation of GraphQL. But I haven't seen any for KGraphQL.
I'm gonna do one that is specifically made for KGraphQL
from kgraphql.
Awesome. also, trying your solution it shows that request
does not have properties for mutation
or variables
Using v0.6.6
from kgraphql.
Related Issues (20)
- Serialization broken for KTOR 2.0.2 HOT 1
- Getting "This should never happen" error on incorrect fragment name
- Idea: Alternative design for integrating with ktor
- Detect absence of optional input fields HOT 3
- Server crashing when update version from 0.17.14 to 0.17.15
- When using fragments, executor resolves a property that is not going to be returned HOT 1
- Unable to use class that inherits from an interface as an inputType
- Error on Ktor 2.0.x HOT 2
- When I use java.util.Date as a class param, I got an serialization issue. HOT 1
- Ktor authentification blocks all routes while using with
- Using enum as argument HOT 1
- @include and @skip directives should exclude content, but instead it's returning null value (except if the directive is applied to the query)
- Support for auto resolving generic types HOT 4
- Discussion - comparison between ExpediaGroup/graphql-kotlin vs aPureBase/KGraphQL HOT 1
- Property __typename does not exist in Query and Mutation
- Top level fields with skip/include directives ignored for mutations
- SDL Driven Option
- GraphQL Errors don't have correct content type
- Allow wrapping all resolvers
- le v7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kgraphql.