Skip to content

Commit 411a79e

Browse files
authored
Merge pull request #1 from graphql-java/http_example
Added a pure HTTP example
2 parents 79ac9e2 + a7f85e7 commit 411a79e

24 files changed

Lines changed: 1250 additions & 0 deletions

http-example/build.gradle

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
buildscript {
2+
ext {
3+
springBootVersion = '2.0.5.RELEASE'
4+
}
5+
repositories {
6+
mavenCentral()
7+
}
8+
dependencies {
9+
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
10+
}
11+
}
12+
13+
apply plugin: 'java'
14+
apply plugin: 'eclipse'
15+
apply plugin: 'org.springframework.boot'
16+
apply plugin: 'io.spring.dependency-management'
17+
18+
group = 'com.graphql-java'
19+
version = '0.0.1-SNAPSHOT'
20+
sourceCompatibility = 1.8
21+
22+
repositories {
23+
mavenCentral()
24+
maven { url "http://dl.bintray.com/andimarek/graphql-java" }
25+
}
26+
27+
28+
dependencies {
29+
compile('org.springframework.boot:spring-boot-starter-web')
30+
compile "com.graphql-java:graphql-java:10.0"
31+
compile 'com.google.guava:guava:26.0-jre'
32+
testCompile('org.springframework.boot:spring-boot-starter-test')
33+
}
53.4 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Sat Sep 15 15:12:07 AEST 2018
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-all.zip

http-example/gradlew

Lines changed: 172 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

http-example/gradlew.bat

Lines changed: 84 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

http-example/readme.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# graphql-java-http-example
2+
3+
An example of using graphql-java in a HTTP application.
4+
5+
It demonstrates the use of `Schema Definition Language (SDL)` to define a schema in a textual way.
6+
7+
It also shows how to use `data loader` to ensure that most efficient way to load
8+
inside a graphql query
9+
10+
Finally it shows how to combine graphql-java `Instrumentation` to create performance tracing
11+
and data loader effectiveness statistics.
12+
13+
To build the code type
14+
15+
./gradlew build
16+
17+
To run the code type
18+
19+
./gradlew bootRun
20+
21+
Point your browser at
22+
23+
http://localhost:8080/
24+
25+
26+
Some example graphql queries might be
27+
28+
{
29+
hero {
30+
name
31+
friends {
32+
name
33+
friends {
34+
id
35+
name
36+
}
37+
38+
}
39+
}
40+
}
41+
42+
43+
or maybe
44+
45+
{
46+
luke: human(id: "1000") {
47+
...HumanFragment
48+
}
49+
leia: human(id: "1003") {
50+
...HumanFragment
51+
}
52+
}
53+
54+
fragment HumanFragment on Human {
55+
name
56+
homePlanet
57+
friends {
58+
name
59+
__typename
60+
}
61+
}
62+
63+

http-example/settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'http-example'

0 commit comments

Comments
 (0)