Skip to content

Add Ballerina language and ballerina-graphql to language support #1337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: ballerina-graphql
description: The Ballerina Standard Library Package for consume GraphQL services.
url: https://lib.ballerina.io/ballerina/graphql/latest
github: ballerina-platform/module-ballerina-graphql
---

To run a `ballerina-graphql` client:

- Download and install [Ballerina Language](https://ballerina.io/downloads)
- Then run `bal run graphql_client.bal` to run the service, with with this code in the `graphql_client.bal` file:

```ballerina
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);
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: ballerina-graphql
description: The Ballerina Standard Library Package for write GraphQL services.
url: https://lib.ballerina.io/ballerina/graphql/latest
github: ballerina-platform/module-ballerina-graphql
---

To run a `ballerina-graphql` hello world server:

- Download and install [Ballerina Language](https://ballerina.io/downloads)
- Then run `bal run graphql_service.bal` to run the service, with with this code in the `graphql_service.bal` file:

```ballerina
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
1 change: 1 addition & 0 deletions src/content/code/slug-map.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ballerina": "Ballerina",
"c-c": "C / C++",
"c-net": "C# / .NET",
"clojure": "Clojure",
Expand Down