This file contains 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 { | |
makeExecutableSchema, | |
addMockFunctionsToSchema | |
} from 'graphql-tools'; | |
import { graphql } from 'graphql'; | |
// Fill this in with the schema string | |
const schemaString = ` | |
type Todo { id: ID, text: String, completed: Boolean } | |
type User { id: ID, name: String } |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<title>Sort reverse</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
<script src="./suite.js"></script> | |
</head> | |
<body> | |
<h1>Open the console to view the results</h1> |
This file contains 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
const typeDefs = gql` | |
type Query { | |
hello: String | |
+ dogPhotoUrl: String | |
} | |
`; | |
const resolvers = { | |
Query: { | |
hello: (root, args, context) => { |
This file contains 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
<Query | |
query={gql` | |
{ | |
hello | |
+ dogPhotoUrl | |
} | |
`} | |
> | |
- {({ data }) => <div>A greeting from the server: {data.hello}</div>} | |
+ {({ data }) => ( |
This file contains 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
// src/lambda/graphql.js | |
const { ApolloServer, gql } = require("apollo-server-lambda"); | |
const typeDefs = gql` | |
type Query { | |
hello: String | |
} | |
`; | |
const resolvers = { |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Add React in One Minute</title> | |
</head> | |
<body> | |
<h2>Add React in One Minute</h2> | |
<p>This page demonstrates using React with no build tooling.</p> |
This file contains 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
const fetch = require("node-fetch"); | |
const { introspectionQuery } = require("graphql"); | |
const fs = require("fs"); | |
fetch("https://1jzxrj179.lp.gql.zone/graphql", { | |
method: "POST", | |
headers: { "Content-Type": "application/json" }, | |
body: JSON.stringify({ query: introspectionQuery }) | |
}) | |
.then(res => res.json()) |
This file contains 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
const { buildClientSchema, printSchema } = require("graphql"); | |
const fs = require("fs"); | |
const introspectionSchemaResult = JSON.parse(fs.readFileSync("result.json")); | |
const graphqlSchemaObj = buildClientSchema(introspectionSchemaResult); | |
const sdlString = printSchema(graphqlSchemaObj); |
This file contains 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
const { buildSchema, graphqlSync, introspectionQuery } = require("graphql"); | |
const sdlString = ` | |
type Query { | |
hello: String | |
} | |
`; | |
const graphqlSchemaObj = buildSchema(sdlString); | |
const result = graphqlSync(graphqlSchemaObj, introspectionQuery).data; |
This file contains 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
const { graphqlSync, introspectionQuery } = require("graphql"); | |
const result = graphqlSync(graphqlSchemaObj, introspectionQuery).data; |