/poke-rest-api-to-graphql

GraphQL version of the popular Pokemon REST API

Primary LanguageJavaScriptMIT LicenseMIT

GraphQL Pokemon API

About The Data

The data comes directly from the popular Pokemon REST API. The REST endpoints have been mapped as GraphQL types and resolvers. A summary of endpoints and documentation can be found here: https://pokeapi.co/docs/v2.html/#pokemon-section

  • No API Key required.
  • PokeAPI has a request limit of 100 requests per minute.

Built With

Getting Started

Install Dependencies:

npm install

Start Server:

npm run server

Execute GraphQL Queries Here (Browser Automatically Opens On Server Start):

http://localhost:4000/graphql

GraphQL Query Examples

Get Pokemon By ID:

{
  getPokemonById(id: 1) {
    id
    name
    height
    is_default
    order
    weight
    abilities {
      slot
      is_hidden
      ability {
        name
        url
      }
    }
    held_items
    location_area_encounters
    moves{
      move {
        name
        url
      }
    }
    species {
      name
      url
    }
    stats {
      base_stat
      effort
      stat {
        name 
        url
      }
    }
    types {
      slot
      type {
        name
        url
      }
    }
  }
}

Get All Pokemon:

{
  getAllPokemon() {
    results {
      name
      url
    }
  }
}