GraphQL
1 min read
graphql
Written in 2018. Tools, APIs and prices may have changed since.
Lab note What I wrote down while learning this by building with it. Short by design; the code is in pfeilbr/graphql-playground.
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