A bundle for providing GraphQL API endpoints in Dropwizard applications.
<dependency>
<groupId>com.smoketurner.dropwizard</groupId>
<artifactId>graphql-core</artifactId>
<version>1.3.9-2</version>
</dependency>
Add a GraphQLBundle
to your Application class.
@Override
public void initialize(Bootstrap<MyConfiguration> bootstrap) {
// ...
final GraphQLBundle<HelloWorldConfiguration> bundle = new GraphQLBundle<HelloWorldConfiguration>() {
@Override
public GraphQLFactory getGraphQLFactory(HelloWorldConfiguration configuration) {
final GraphQLFactory factory = configuration.getGraphQLFactory();
// the RuntimeWiring must be configured prior to the run()
// methods being called so the schema is connected properly.
factory.setRuntimeWiring(buildWiring(configuration));
return factory;
}
};
bootstrap.addBundle(bundle);
}
This bundle includes a modified version of the HelloWorldApplication
from Dropwizard's Getting Started documentation.
You can execute this application on your local machine then running:
./mvnw clean package
java -jar graphql-example/target/graphql-example-1.3.9-3-SNAPSHOT.jar server graphql-example/hello-world.yml
This will start the application on port 8080
with a GraphiQL interface for exploring the API.
Please file bug reports and feature requests in GitHub issues.
Copyright (c) 2019 Smoke Turner, LLC
This library is licensed under the Apache License, Version 2.0.
See http://www.apache.org/licenses/LICENSE-2.0.html or the LICENSE file in this repository for the full license text.