Awesome
Convert Weather REST API to a GraphQL API
Overview
This is an example to demonstrate how to convert an existing REST API to a GraphQL API using Ballerina.
This uses the Weather API REST api and converts it to a GraphQL API.
Prerequisites
- Download and Install Ballerina
- Obtain a valid API key from Weather API
Running the Example
To run this sample,
-
Checkout this repository
-
Go into the
weather-rest-api-to-graphql
directory -
Add a
Config.toml
file with the following contentAPI_KEY="<Your weatherapi.com API key>"
You can find a sample
Config.toml
file in the same directory, namedConfig.toml.sample
. -
Then execute the following
bal
commandbal run
-
Test the API with builtin GraphiQL client on this link: http://localhost:4000/weather-test
About Ballerina GraphQL
Ballerina GraphQL is a Ballerina Standard Library that can be used to expose and consume GraphQL APIs.
Ballerina is an open-source project and it is licensed under Apache License 2.0 by WSO2, Inc.
Contributions are always welcome and a star on the GitHub repo is also appreciated!