Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/audreyfeldroy/pokemon-remote-schema
Hasura remote schema providing a GraphQL API for PokéAPI
https://github.com/audreyfeldroy/pokemon-remote-schema
Last synced: 16 days ago
JSON representation
Hasura remote schema providing a GraphQL API for PokéAPI
- Host: GitHub
- URL: https://github.com/audreyfeldroy/pokemon-remote-schema
- Owner: audreyfeldroy
- Created: 2020-04-24T05:18:24.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-12-11T03:23:22.000Z (almost 2 years ago)
- Last Synced: 2024-04-16T04:06:06.789Z (7 months ago)
- Language: JavaScript
- Size: 117 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pokemon-remote-schema
Converting the PokeAPI to GraphQL via a Hasura remote schema.
1. Schema:
```
type Pokemon {
id: String!
name: String!
base_experience: Int!
}type Query {
getPokemon(id: String!): Pokemon
}
`;const resolvers = {
Query: {
// hello: () => "world",
getPokemon: async (_, { id }) => {
const response = await fetch(MY_REST_URL + '/pokemon/' + id + '/');
return response.json();
},
}
```2. Click on **Show** *Live* at the top of the Glitch UI to get the URL.
3. Add as Remote Schema in Hasura GraphQL Engine.
4. Go to GraphiQL tab, and try out:
``` gql
query {
getPokemon(id: "pikachu"){
id
base_experience
}
}
```