mirror of
https://github.com/FranP-code/countries.git
synced 2025-10-13 00:02:15 +00:00
Update readme
This commit is contained in:
16
README.md
16
README.md
@@ -1,21 +1,27 @@
|
|||||||
<img align="right" src="https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/155/earth-globe-americas_1f30e.png" alt="globe" width="120">
|
<p align="center">
|
||||||
|
<img src="./logo.png" alt="globe">
|
||||||
|
</p>
|
||||||
|
|
||||||
# Countries GraphQL API
|
<h1 align="center">Countries GraphQL API</h1>
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
|
||||||
[](https://github.com/trevorblades/countries/actions)
|
[](https://github.com/trevorblades/countries/actions)
|
||||||
[](CODE_OF_CONDUCT.md)
|
[](CODE_OF_CONDUCT.md)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
A public GraphQL API for information about countries, continents, and languages. This project uses [Countries List](https://annexare.github.io/Countries/) and [`provinces`](https://github.com/substack/provinces) as data sources, so the schema follows the shape of that data, with a few exceptions:
|
A public GraphQL API for information about countries, continents, and languages. This project uses [Countries List](https://annexare.github.io/Countries/) and [`provinces`](https://github.com/substack/provinces) as data sources, 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.
|
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.
|
2. The `country.continent` and `country.languages` are now objects and arrays of objects, respectively.
|
||||||
3. Each `Country` has an array of `states` populated by their states/provinces, if any.
|
3. Each `Country` has an array of `states` populated by their states/provinces, if any.
|
||||||
|
|
||||||
## Writing queries
|
## Writing queries
|
||||||
|
|
||||||
```graphql
|
```graphql
|
||||||
{
|
{
|
||||||
country(code: "BR") {
|
country(code: BR) {
|
||||||
name
|
name
|
||||||
native
|
native
|
||||||
emoji
|
emoji
|
||||||
@@ -49,6 +55,8 @@ The above GraphQL query will produce the following JSON response:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Docs
|
||||||
|
|
||||||
Check out [the playground](https://countries.trevorblades.com) to explore the schema and test out some queries.
|
Check out [the playground](https://countries.trevorblades.com) to explore the schema and test out some queries.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|||||||
Reference in New Issue
Block a user