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
const mutation = graphql` | |
mutation MarkReadNotificationMutation( | |
$input: MarkReadNotificationData! | |
) { | |
markReadNotification(data: $input) { | |
notification { | |
seenState | |
} | |
} | |
} |
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
<QueryRenderer | |
environment={environment} | |
query={graphql` | |
query AppFeedQuery { | |
feed (type: NEW, limit: 5) { | |
repository { | |
owner { login } | |
name | |
stargazers_count |
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
require('isomorphic-fetch'); | |
fetch('https://1jzxrj179.lp.gql.zone/graphql', { | |
method: 'POST', | |
headers: { 'Content-Type': 'application/json' }, | |
body: JSON.stringify({ query: '{ posts { title } }' }), | |
}) | |
.then(res => res.json()) | |
.then(res => console.log(res.data)); |
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
const { createApolloFetch } = require('apollo-fetch'); | |
const fetch = createApolloFetch({ | |
uri: 'https://1jzxrj179.lp.gql.zone/graphql', | |
}); | |
fetch({ | |
query: '{ posts { title }}', | |
}).then(res => { | |
console.log(res.data); |
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
export default graphql(gql`{ | |
feed(type: TOP, limit: 10) { | |
repository { | |
name | |
owner { login } | |
} | |
postedBy { login } | |
} | |
}`)(props => ( | |
<List> |
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
export default graphql(gql` | |
mutation submitRepository($repoFullName: String!) { | |
submitRepository(repoFullName: $repoFullName) { | |
createdAt | |
} | |
} | |
`)(props => ( | |
<button | |
onClick={() => { | |
// Mutate function passed via props |
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
const { makeExecutableSchema } = require('graphql-tools'); | |
const typeDefs = ` | |
type Query { | |
books: [Book] | |
} | |
type Book { | |
title: String | |
author: String | |
} |
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
// Install and import the apollo-engine package | |
const { ApolloEngine } = require('apollo-engine'); | |
const { graphqlExpress } = require('apollo-server-express'); | |
const app = express(); | |
// Enable tracing and cacheControl in Apollo Server | |
app.use('/graphql', graphqlExpress({ | |
tracing: true, | |
cacheControl: true, |
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
{ | |
"apiKey": "TODO", | |
"origins": [ | |
{ | |
"lambda": { | |
"functionArn": "TODO", | |
"awsAccessKeyId": "TODO", | |
"awsSecretAccessKey":"TODO" | |
} | |
} |
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
// Construct a schema, using the GraphQL schema language | |
const typeDefs = gql` | |
type Query { | |
myFavoriteArtists: [Artist] | |
} | |
type Artist @cacheControl(maxAge: 60) { | |
id: ID | |
name: String | |
image: String |