/swapi-graphql

GraphQL server for Star Wars API (SWAPI)

Primary LanguageJavaScript

swapi-graphql Build Status

GraphQL server for Star Wars API (SWAPI)

Setup

yarn install

or

npm install

Test in graphiql

http://localhost:4000/graphql

Types

Support for

  • Characters
  • Films
  • Vehicles
  • Planets
  • Starships
  • TODO Species

Query examples

Return character

query CharacterQuery($id: String!) {
  character(id: $id) {
    name
    birthYear
    eyeColor
    gender
    hairColor
    height
    mass
    skinColor
  }
}

Return character with populated films

query CharacterQuery($id: String!) {
  character(id: $id) {
    name
    films {
      title
    }
  }
}

Return film

query FilmsQuery($id: String!) {
  films(id: $id) {
    title
    releaseDate
    director
    episodeID
    openingCrawl
    producer
  }
}

TODO

  • Cache/batch requests
  • Rewrite SWAPI service
  • Add Species Type
  • Add more tests