-
Notifications
You must be signed in to change notification settings - Fork 15
Getting Started
Arash Shokoufandeh edited this page Oct 25, 2016
·
21 revisions
#Getting Started
Example for Maven:
<dependency>
<groupId>com.nfl.glitr</groupId>
<artifactId>glitr</artifactId>
<version>x.y.z</version>
</dependency>
Example for gradle:
compile("com.nfl.glitr:glitr:x.y.z")
import com.nfl.glitr.Glitr;
import com.nfl.glitr.GlitrBuilder;
import com.nfl.glitr.annotation.GlitrDescription;
import graphql.GraphQL;
import graphql.schema.DataFetchingEnvironment;
import java.util.Map;
public class HelloWorld {
public static void main(String[] args) {
Glitr glitr = GlitrBuilder.newGlitr()
.withQueryRoot(new Root())
.build();
GraphQL graphQL = new GraphQL(glitr.getSchema());
Map<String, Object> result = (Map<String, Object>) graphQL.execute("{hello}").getData();
System.out.println(result); // Prints: {hello=World!}
}
@GlitrDescription("Where it all begins.")
public static class Root {
public String getHello(DataFetchingEnvironment environment) {
return "World!";
}
}
}
To build:
$ git clone git@github.com:NFL/glitr.git
$ cd glitr/
$ ./gradlew build
$ ./gradlew test
Copyright 2016 NFL Enterprises LLC.
NFL Engineers blog | Twitter @nflengineers | Jobs