Skip to content

loivis/pokeapi-typegraphql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pokeapi-typegraphql

An implementation of pokeapi.co with GraphQL using TypeGraphQL.

Schemas are created based on Pokeapi V2 API Reference but it doesn't seem to be the latest. Some(but don't remember which ones) are updated according to actual api responses by the time of coding in early May, 2019.

Try it out >>> >> > pokeapi-typegraphql on heroku < << <<<

CAUTION: Some schema returns array with hundreds of elements, which causes the same amount of requests towards pokeapi.co.

pokeapi.co Fair Use Policy

PokéAPI is free and open to use. It is also very popular. Because of this, we ask every developer to abide by our fair use policy. People not complying with the fair use policy will have their IP address permenantly banned.

PokéAPI is primarily an educational tool, and we will not tolerate denial of service attacks preventing people from learning.

Rules:

Locally cache resources and images whenever you request them.
Use the correct user-agent header in API requests.
Be nice and friendly to your fellow PokéAPI developers.

TODO

  • InputUnion type to merge byId and byName as one (upstream feature not ready yet)

  • load all data in database(SQL/NoSQL?) to elimicate requests to pokeapi.co

Tryout locally

yarn install && yarn dev

By default, server will listen on port 4000: http://localhost:4000/graphql

Query example

{
  pokemonByID(id: 1) {
    name
    weight
    abilities {
      ability {
        name
        isMainSeries
        generation {
          name
          mainRegion {
            name
          }
        }
      }
    }
    sprites {
      frontDefault
      frontShiny
      frontFemale
      frontShinyFemale
    }
  }
}

List of schemas

  • Ability

  • Berry

  • BerryFirmness

  • BerryFlavor

  • Characteristic

  • ContestEffect

  • ContestType

  • EggGroup

  • EncounterCondition

  • EncounterConditionValue

  • EncounterMethod

  • EvolutionChain

  • EvolutionTrigger

  • Gender

  • Generation

  • GrowthRate

  • Item

  • ItemAttribute

  • ItemCategory

  • ItemPocket

  • Language

  • Location

  • LocationArea

  • Machine

  • Move

  • MoveAilment

  • MoveBattleStyle

  • MoveCategory

  • MoveDamageClass

  • MoveLearnMethod

  • MoveTarget

  • Nature

  • PalParkArea

  • PokeathlonStat

  • Pokedex

  • Pokemon

  • PokemonColor

  • PokemonHabitat

  • PokemonForm

  • PokemonShape

  • PokemonSpecies

  • Region

  • Stat

  • SuperContestEffect

  • Type

  • Version

  • VersionGroup