This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// graphql/index.js | |
import ApolloClient, { createNetworkInterface } from "react-apollo"; | |
const createClient = ({ endpointUri: uri, onError }) => { | |
const networkInterface = createNetworkInterface({ uri }); | |
networkInterface.useAfter([{ | |
applyAfterware({ response }, next) { | |
if (response.status === 500) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// index.js | |
import { render } from "react-dom"; | |
import { ApolloProvider } from "react-apollo"; | |
import { App } from "./App"; | |
import { createClient } from "./graphql"; | |
const $app = document.getElementById("app"); | |
const client = createClient({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// index.js | |
import { render } from "react-dom"; | |
import { ApolloProvider } from "react-apollo"; | |
import { App } from "./App"; | |
import { createClient } from "./graphql"; | |
const $app = document.getElementById("app"); | |
const client = createClient({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// graphql/index.js | |
import ApolloClient, { createNetworkInterface } from "react-apollo"; | |
const createClient = ({ endpointUri: uri }) => { | |
const networkInterface = createNetworkInterface({ uri }); | |
networkInterface.useAfter([{ | |
applyAfterware({ response }, next) { | |
// Do something with the response ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { compose } from "recompose"; | |
import { graphql, gql } from "react-apollo"; | |
import { ErrorHandler } from "./components"; | |
const NewsList = compose( | |
graphql(gql` | |
query news { | |
id | |
name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createTelemetryBinding } from "./binding"; | |
const app = async () => { | |
const telemetry = await createTelemetryBinding( | |
"https://kqxrmk1pr7.lp.gql.zone/graphql" | |
); | |
while (true) { | |
const userTelemetry = await telemetry.query.user({}, {}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { readFile } from "fs"; | |
import { join as joinPath } from "path"; | |
import { promisify } from "util"; | |
import fetch from "node-fetch"; | |
import { makeRemoteExecutableSchema } from "graphql-tools"; | |
import { createHttpLink } from "apollo-link-http"; | |
import { Binding as TelemetryBinding } from "./telemetry"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
user { | |
id | |
measuredAt | |
registrations | |
logins | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { request } from "graphql-request"; | |
export const fetchUserRegistrationsInLastHour = async (period: string) => { | |
const query = ` | |
query UserRegistrationsWithinPeriod($period: String!) { | |
users(where: { | |
createdAt: $period | |
} { | |
id | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface InviteInput { | |
input: { | |
email: string; | |
message?: string; | |
} | |
} | |
const invite = async (parent, args: InviteInput, context: Context, info) => { | |
await context.messaging.publish({ | |
type: "Invite", |