Skip to content

Instantly share code, notes, and snippets.

@helfer
helfer / apollo-server-tracer.js
Last active October 22, 2016 15:30
How to instrument apollo server 0.2 with tracer
import express from 'express';
import { Tracer } from 'graphql-tracer';
import { apolloExpress } from 'apollo-server';
import Schema from './schema';
const app = express();
const tracer = new Tracer({ TRACER_APP_KEY: '...'});
addTracingToResolvers(Schema);
import express from 'express';
import Schema from './data/schema';
import Resolvers from './data/resolvers';
// import Mocks from './data/mocks';
import { apolloExpress, graphiqlExpress } from 'apollo-server';
import { makeExecutableSchema, addMockFunctionsToSchema } from 'graphql-tools';
import bodyParser from 'body-parser';
const GRAPHQL_PORT = 8080;
# Autogenerated input type of AddComment
input AddCommentInput {
# A unique identifier for the client performing the mutation.
clientMutationId: String
# The Node ID of the subject to modify.
subjectId: ID!
# The contents of the comment.
body: String!
# mutation to add a reaction:
mutation test($input: AddReactionInput!){
addReaction(input: $input){
reaction {
content
}
}
}
# the variables (paste those in the bottom textarea)
@helfer
helfer / apollo-1-migration.md
Last active May 31, 2017 01:09
Migrating from Apollo Client 0.x to 1.0

Migrating from Apollo Client 0.x to 1.0

Here are the main breaking changes between the 0.x and 1.0 versions of Apollo Client.

fetchMore

The structure of fetchMoreResult has been changed. Previously fetchMoreResult used to contain data and loading fields, now fetchMoreResult is what fetchMoreResult.data used to be. This means your updateQueries function has to change as follows:

updateQuery: (prev, { fetchMoreResult }) => {
/**
* lagRadar
* Licence: ISC copyright: @mobz 2018
*/
window.lagRadar = function lagRadar( config = {} ) {
const {
frames = 50, // number of frames to draw, more = worse performance
speed = 0.0017, // how fast the sweep moves (rads per ms)
size = 300, // outer frame px