ChristianRuiz / countries

🌎 A GraphQL API for information about countries

Home Page:https://countries.trevorblades.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

globe

Countries GraphQL API

Build Status Donate

A public GraphQL API for information about countries, continents, and languages. This project uses Countries List as a data source, so the schema follows the shape of that data, with a few exceptions:

  1. The codes used to key the objects in the original data are available as a code property on each item returned from the API.
  2. The continent and languages properties are now objects and arrays of objects, respectively.

Writing queries

{
  country(code: "BR") {
    name
    native
    emoji
    currency
    languages {
      code
      name
    }
  }
}

The above GraphQL query will produce the following JSON response:

{
  "data": {
    "country": {
      "name": "Brazil",
      "native": "Brasil",
      "emoji": "πŸ‡§πŸ‡·",
      "currency": "BRL",
      "languages": [
        {
          "code": "pt",
          "name": "Portuguese"
        }
      ]
    }
  }
}

Check out the playground to explore the schema and test out some queries.

Examples

About

🌎 A GraphQL API for information about countries

https://countries.trevorblades.com


Languages

Language:JavaScript 100.0%