🎬 That's a Wrap for GraphQLConf 2024! • Watch the Videos • Check out the recorded talks and workshops

Code Using GraphQL

Sort by:
ballerina-graphql
The Ballerina Standard Library Package for consume GraphQL services.
Last release 2 months ago139Apache License 2.0
README

To run a ballerina-graphql client:

  • Download and install Ballerina Language
  • Then run bal run graphql_client.bal to run the service, with this code in the graphql_client.bal file:
import ballerina/graphql;
import ballerina/io;
 
type Response record {
    record { string hello; } data;
};
 
public function main() returns error? {
    graphql:Client helloClient = check new ("localhost:9090/graphql");
    string document = "{ hello }";
    Response response = check helloClient->execute(document);
    io:println(response.data.hello);
}

Features

  • Dependently-typed response retrieval with Ballerina type inferring
  • Custom client generation support
ballerina-graphql
The Ballerina Standard Library Package for write GraphQL services.
Last release 2 months ago139Apache License 2.0
README

To run a ballerina-graphql hello world server:

  • Download and install Ballerina Language
  • Then run bal run graphql_service.bal to run the service, with this code in the graphql_service.bal file:
import ballerina/graphql;
 
service /graphql on new graphql:Listener(9090) {
    resource function get hello() returns string {
        return "Hello, world!";
    }
}

Features

  • Built with Ballerina service and listener model, which are first-class citizens in Ballerina
  • Supports subscriptions over websocket (No additional libraries needed)
  • Supports file upload
  • Built-in GraphiQL client