Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/daggerok/boot-graphql

This repository contains spring-boot + graphql-java example
https://github.com/daggerok/boot-graphql

gradle graphql graphql-java h2-database kotlin maven spring-boot

Last synced: 16 days ago
JSON representation

This repository contains spring-boot + graphql-java example

Awesome Lists containing this project

README

        

= GraphQL | Spring Boot image:https://travis-ci.org/daggerok/boot-graphql.svg?branch=master["Build Status", link="https://travis-ci.org/daggerok/boot-graphql"]

This repository contains spring-boot + graphql-java example using awesome kotlin language

== graphql

.query people endpoint
----
echo '{"query":"{ people { id name } }"}' | http post :8080
HTTP/1.1 200
# skip headers...
{
"data": {
"people": [
{
"id": 1,
"name": "Max"
},
{
"id": 2,
"name": "Bax"
},
{
"id": 3,
"name": "Fax"
}
]
}
}
----

.query person by it's id
----
echo '{"query":"{ person(id: \"1\") { name addressId } }"}' | http post :8080
HTTP/1.1 200
# skip headers
{
"data": {
"person": {
"addressId": 1,
"name": "Max"
}
}
}
----

== maven

.build and run using maven wrapper
----
mvn -N io.takari:maven:wrapper
bash mvnw package spring-boot:run
# or bash mvnw package -DskipTests; java -jar target/*.jar
----

== gradle

.build and run using gradle wrapper
----
gradle wrapper
bash gradlew build bRun
# or bash gradlew as; bash build/libs/*.jar
----

== rtfm

. link:https://docs.spring.io/spring-data/rest/docs/current/reference/html/#_the_hal_browser[hap browser]