Some experiments with wiring up Vert.x, Guice and GraphQL together.
- Execute:
./gradlew vertxRun
- Point your browser to:
http://localhost:8080/graphql
./gradlew clean shadowJar
docker build -t spodin/library .
docker run -t -d --name library -p 8080:8080 spodin/library
Send POST
to /graphql
with JSON body.
Example:
{
"query":"query{books{id,name,author{id,name}}}",
"variables":{}
}
Currently, only one query per call is supported due to limitations of GraphQL Java implementation.
{
"query":"mutation{changeBookName(id: 1, name: \"New Book Name\")}",
"variables":{}
}
same, but with variables:
{
"query":"mutation($bookId: Int!, $newBookName: String!){changeBookName(id: $bookId, name: $newBookName)}",
"variables":{"bookId":1, "newBookName":"New Book Name"}
}
Execute your introspection query (as described above),
or get full schema declaration via GET
request to /graphql
.