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 graphql = require('graphql'); | |
const GraphQLRelay = require('graphql-relay'); | |
const introspectionQuery = require('graphql/utilities').introspectionQuery; | |
state.graphql_todos = state.graphql_todos || {}; | |
var nodeDefinitions = GraphQLRelay.nodeDefinitions(function(globalId) { | |
var idInfo = GraphQLRelay.fromGlobalId(globalId); | |
if (idInfo.type == 'Todo') return state.graphql_todos[idInfo]; | |
if (idInfo.type == 'Todos') return state.graphql_todos; |
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>React and GraphQL Todo-App</title> | |
</head> | |
<body> | |
<div id="todoApp"></div> | |
<footer> | |
<br><br> |
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 graphql = require('graphql'); | |
const GraphQLRelay = require('graphql-relay'); | |
state.graphql_todos = state.graphql_todos || {}; | |
var nodeDefinitions = GraphQLRelay.nodeDefinitions(function(globalId) { | |
var idInfo = GraphQLRelay.fromGlobalId(globalId); | |
if (idInfo.type == 'Todo') return state.graphql_todos[idInfo]; | |
return null; | |
}); |
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>React and GraphQL Todo-App</title> | |
</head> | |
<body> | |
<div id="todoApp"></div> | |
<footer> | |
<br><br> |
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 graphql = require('graphql'); | |
state.graphql_todos = state.graphql_todos || {}; | |
var todoType = new graphql.GraphQLObjectType({ | |
name: 'Todo', | |
fields: { | |
id: { type: graphql.GraphQLInt }, | |
isDone: { type: graphql.GraphQLBoolean}, | |
description: { type: graphql.GraphQLString }, | |
} |
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><title>LOG Event-Stream</title></head> | |
<body> | |
<h1>LOG Event-Stream</h1> | |
<ul id="changesList"> | |
<li>stream started</li> | |
</ul> | |
</body> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js"></script> |
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
/* | |
GitHub: create GitHub-App https://github.com/settings/applications | |
Twitter: create Twitter-App https://apps.twitter.com | |
Facebook: https://developers.facebook.com/apps | |
Google: create Google-App https://console.developers.google.com | |
*/ | |
const request = require('request-promise'); | |
const OAuth = require('oauth'); |
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
this.GET = history; | |
this.POST = send; | |
this[req.method](req.params.id, req.body); | |
function history(key){ | |
res.send([]); | |
} |
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 EventEmitter = require('events').EventEmitter; | |
let count = 0; | |
events.myStream = events.myStream || new EventEmitter(); | |
events.myStream.removeAllListeners('data'); | |
events.myStream.on('data', handleEvents); | |
var intervalRef = setInterval(() => { | |
events.myStream.emit('data', { message: 'my event', count: count++ }); | |
}, 5000); |
NewerOlder