Skip to content

Commit 3df768b

Browse files
Add Ballerina language and ballerina-graphql to language support (#1337)
* Add Ballerina language and ballerina-graphql to language support * Add ballerina to slug-map * Add example for Ballerina client
1 parent 7eefc85 commit 3df768b

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: ballerina-graphql
3+
description: The Ballerina Standard Library Package for consume GraphQL services.
4+
url: https://lib.ballerina.io/ballerina/graphql/latest
5+
github: ballerina-platform/module-ballerina-graphql
6+
---
7+
8+
To run a `ballerina-graphql` client:
9+
10+
- Download and install [Ballerina Language](https://ballerina.io/downloads)
11+
- Then run `bal run graphql_client.bal` to run the service, with with this code in the `graphql_client.bal` file:
12+
13+
```ballerina
14+
import ballerina/graphql;
15+
import ballerina/io;
16+
17+
type Response record {
18+
record { string hello; } data;
19+
};
20+
21+
public function main() returns error? {
22+
graphql:Client helloClient = check new ("localhost:9090/graphql");
23+
string document = "{ hello }";
24+
Response response = check helloClient->execute(document);
25+
io:println(response.data.hello);
26+
}
27+
```
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: ballerina-graphql
3+
description: The Ballerina Standard Library Package for write GraphQL services.
4+
url: https://lib.ballerina.io/ballerina/graphql/latest
5+
github: ballerina-platform/module-ballerina-graphql
6+
---
7+
8+
To run a `ballerina-graphql` hello world server:
9+
10+
- Download and install [Ballerina Language](https://ballerina.io/downloads)
11+
- Then run `bal run graphql_service.bal` to run the service, with with this code in the `graphql_service.bal` file:
12+
13+
```ballerina
14+
import ballerina/graphql;
15+
16+
service /graphql on new graphql:Listener(9090) {
17+
resource function get hello() returns string {
18+
return "Hello, world!";
19+
}
20+
}
21+
```
22+
23+
## Features
24+
- Built with Ballerina `service` and `listener` model, which are first-class citizens in Ballerina
25+
- Supports subscriptions over websocket (No additional libraries needed)
26+
- Supports file upload
27+
- Built-in GraphiQL client

src/content/code/slug-map.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"ballerina": "Ballerina",
23
"c-c": "C / C++",
34
"c-net": "C# / .NET",
45
"clojure": "Clojure",

0 commit comments

Comments
 (0)