Skip to main content

GraphQL Dabbles

Most modern web applications expose an application programming interface or API. An API allows for programmatic access to the application's data and functionality that is separate from the application's user interface.

Good GraphQL API Examples

Topics Covered

  • An introduction to APIs

  • REST vs GraphQL

  • Tools and Frameworks

  • An API provides a way for a client program to access data and functionality that resides on a server.

There are two common approaches to providing an API they are

  • REST
  • GraphQL

GraphQL is a query language for your API, and a server-side runtime for executing queries using a type system you define for your data.

RESTGraphQLNote
Can use any HTTP methodUses just POST
Multiple URL endpointsOne URL endpoint
HTTP Body contains any dataAlways contains GraphQL
Response data is defined on the serverResponse data is defined by the client

Operations

  • Queries - Get data
  • Mutations - Add / Update / Delete Data
  • Subscriptions - Get event notifications pushed when something happens. For example, a subscription could enable an update to an external API or database when new data is added using a mutation.

GraphQL

  • Created at Facebook and OpenSourced in 2015
  • Graphical (GraphQL IDE)
  • Operations: query, mutation, and subscription (notification of changes, uses web sockets)
  • Apollo Package https://www.apollographql.com/

Resources