matdurand / demo-graphql-rest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Apollo Server Example Dog API

An example of using GraphQL to wrap a REST API. An implementation of Apollo Server wrapping the Dog API .

Getting started

Start by cloning the repository locally. Ensure you have the latest Node and npm.

Install the required dependencies.

$ yarn

Start the development environment.

$ yarn start

Open the playground in your browser http://localhost:4000/

Example query

query breedList($breed: String!) {
  dogs(breed: $breed) {
    breed
    imageUrl
  }
  breed(breed: $breed) {
    name
    dogs {
      breed
      imageUrl
    }
  }
  breeds {
    dogs {
      breed
      imageUrl
    }
  }
}

TypeScript type generation from GraphQL types

TypeScript types are generated automatically from GraphQL types. Found in src/generated-schema-types.ts To update this file with type changes run

$ yarn generate-types

Note: Typically generated types shouldn't be commited to repository. This file is being comitted to aid in references this repository.

About


Languages

Language:TypeScript 98.0%Language:JavaScript 2.0%