Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nfl/graphql-rxjava
GraphQL RxJava
https://github.com/nfl/graphql-rxjava
Last synced: 29 days ago
JSON representation
GraphQL RxJava
- Host: GitHub
- URL: https://github.com/nfl/graphql-rxjava
- Owner: nfl
- License: mit
- Created: 2015-11-08T20:55:11.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-15T11:53:39.000Z (over 7 years ago)
- Last Synced: 2024-05-19T14:31:30.334Z (7 months ago)
- Language: Java
- Homepage:
- Size: 0 Bytes
- Stars: 52
- Watchers: 35
- Forks: 14
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-graphql-java - graphql-rxjava
README
# graphql-rxjava
This is an execution strategy for [graphql-java](https://github.com/andimarek/graphql-java) that makes
it easier to use rxjava's Observable. It currently requires Java8.[![Build Status](https://travis-ci.org/nfl/graphql-rxjava.svg)](https://travis-ci.org/nfl/graphql-rxjava)
# Table of Contents
- [Rx Hello World](#hello-world)
- [License](#license)### Rx Hello World
This is the famous "hello world" in graphql-rxjava:
```java
import graphql.schema.GraphQLObjectType;
import graphql.schema.GraphQLSchema;import graphql.execution.RxExecutionStrategy;
import graphql.execution.RxExecutionResult;import static graphql.Scalars.GraphQLString;
import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition;
import static graphql.schema.GraphQLObjectType.newObject;public class HelloWorld {
public static void main(String[] args) {
GraphQLObjectType queryType = newObject()
.name("helloWorldQuery")
.field(newFieldDefinition()
.type(GraphQLString)
.name("hello")
.staticValue(Observable.just("world")))
.build())
.build();GraphQLSchema schema = GraphQLSchema.newSchema()
.query(queryType)
.build();Observable> result = ((RxExecutionResult)new GraphQL(schema, new RxExecutionStrategy()).execute("{hello}")).getDataObservable();
result.subscribe(System.out::println);
// Prints: {hello=world}
}
}
```### Getting started with gradle
Make sure `mavenCentral` is among your repos:
```groovy
repositories {
mavenCentral()
}```
Dependency:```groovy
dependencies {
compile 'com.graphql-java:graphql-rxjava:0.0.1'
}```
### License
graphql-rxjava is licensed under the MIT License. See [LICENSE](LICENSE) for details.
Copyright (c) 2015, NFL and [Contributors](https://github.com/nfl/graphql-java/graphs/contributors)
[graphql-js License](https://github.com/graphql/graphql-js/blob/master/LICENSE)