ThisaruGuruge / weather-rest-api-to-graphql

An example Ballerina project to convert a REST API to a GraphQL API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

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 content

    API_KEY="<Your weatherapi.com API key>"

    You can find a sample Config.toml file in the same directory, named Config.toml.sample.

  • Then execute the following bal command

    bal 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!

Star on Github

About

An example Ballerina project to convert a REST API to a GraphQL API.

License:Apache License 2.0


Languages

Language:Ballerina 100.0%