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 gql = require('graphql-tag'); | |
const { makeExecutableSchema } = require('graphql-tools'); | |
const books = [ | |
// ... | |
]; | |
const typeDefs = gql` | |
# ... | |
`; |
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
{ | |
"projects": { | |
"default": "the-id-of-your-project" | |
} | |
} |
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 { ApolloServer, gql } = require('apollo-server'); | |
// This is a (sample) collection of books we'll be able to query | |
// the GraphQL server for. A more complete example might fetch | |
// from an existing data source like a REST API or database. | |
const books = [ | |
{ | |
title: 'Harry Potter and the Chamber of Secrets', | |
author: 'J.K. Rowling', | |
}, |
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
language: node_js | |
node_js: | |
- '8' | |
- '10' | |
cache: npm |
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
Show hidden characters
{ | |
"extends": "eslint:recommended", | |
"parserOptions": { | |
"ecmaVersion": 2019 | |
}, | |
"env": { | |
"node": true, | |
"es6": true | |
}, | |
"overrides": [{ |
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
'a'.charCodeAt(0); | |
// 97 | |
Buffer.from('a').toString('hex') | |
// 61 |
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
// Click on the fruit name toggles the fruit's edible property |
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
// Event callbacks don't need a refresh, they trigger one automatically | |
log(); |
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
// The model is accessible with the name `vscope` | |
// | |
// `json` has also methods to handle arrays | |
// - push | |
// - splice | |
// - shift | |
json.push(vscope.things, "Mangos"); | |
log(); | |
hsp.refresh(); |
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
// The model is accessible with the name `vscope` | |
// To refresh a template, call `refresh()` | |
json.set(vscope, "message", 'Have a nice refresh.'); | |
log(); | |
hsp.refresh(); |
NewerOlder