GraphQL

project to learn and experiment with graphql using Apollo

server

  • location - `src/server'
  • entrypoint - src/server/index.ts
  • dev (reload on change) - npm run dev
  • run - npm start

client

  • location - `src/client'
  • entrypoint - src/client/App.tsx
  • run - npm start

ensure server is running on port 3000

Examples

Run via GraphiQL @ http://localhost:3000/graphiql

query {
  books {
    id,
    title,
    author
  }
}

mutation {
  createBook(title: "How To", author: "John Doe") {
    id,
    title
    author
  }
}

subscription onBookAdded {
  bookAdded {
    id
    title
    author
  }
}

Screenshots

subscriptiion push over websocket

Scratch