在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):smoketurner/dropwizard-graphql开源软件地址(OpenSource Url):https://github.com/smoketurner/dropwizard-graphql开源编程语言(OpenSource Language):Java 91.1%开源软件介绍(OpenSource Introduction):Dropwizard GraphQL BundleA bundle for providing GraphQL API endpoints in Dropwizard applications. Dependency Info<dependency>
<groupId>com.smoketurner.dropwizard</groupId>
<artifactId>graphql-core</artifactId>
<version>2.0.7-1</version>
</dependency> UsageAdd a @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);
} Adding GraphQL along with REST API Endpoints in DropwizardTo use GraphQL along with REST APIs in dropwizard you need to change the root path in the bundle which we add in the main class of dropwizard. Otherwise the bundle may conflict with root path of REST API's. You need to add the root path by overiding the
This is the default Now the overriden method which we add while adding bundle is
This avoids conflict between REST API and GraphQL endpoints. When we start the dropwizard server the GraphQL playground looks for GraphQL schema.GraphQL dropwizard creates a
schema.json file after processing our GraphQL schema. The GraphQL playground looks out for this schema. It looks out
at If we want our schema.json to be available at
Example ApplicationThis bundle includes a modified version of the You can execute this application on your local machine then running:
This will start the application on port SupportPlease file bug reports and feature requests in GitHub issues. LicenseCopyright (c) 2020 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. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论