Skip to content

Instantly share code, notes, and snippets.

View zgababa's full-sized avatar

Fabien de Maestri zgababa

  • Paris
View GitHub Profile
@zgababa
zgababa / tuto_graphql_1.js
Last active January 22, 2017 11:05
index.js
'use strict';
const express = require('express');
const app = express();
const PORT = 3001;
app.listen(PORT, () => {
console.log('Server running on port', PORT);
});
'use strict';
const graphql = require('graphql');
const pokemonType = new graphql.GraphQLObjectType({
name : 'PokemonType',
fields : {
id : {
type : graphql.GraphQLString
},
'use strict';
const graphql = require('graphql');
const pokemonType = new graphql.GraphQLObjectType({
name : 'PokemonType',
fields : {
id : {
type : graphql.GraphQLString
},
'use strict';
const express = require('express');
const graphql = require('graphql').graphql;
const rootSchema = require('./schema/rootSchema');
const app = express();
const PORT = 3001;
'use strict';
const graphql = require('graphql');
const pokemonType = require('./pokemon/pokemon');
const schema = new graphql.GraphQLSchema({
query : new graphql.GraphQLObjectType({
name : 'Query',
fields : {
pokemon : pokemonType
'use strict';
const express = require('express');
const graphql = require('graphql').graphql;
const graphqlHTTP = require('express-graphql');
const rootSchema = require('./schema/rootSchema');
const app = express();
const PORT = 3001;
'use strict';
const request = require('request-promise');
const path = require('path');
const Promise = require('bluebird');
const BASE_PATH = 'http://pokeapi.co/api/v2/';
function getPokemon(id) {
return request({
'use strict';
const graphql = require('graphql');
const client = require('./pokemon.client');
const pokemonType = new graphql.GraphQLObjectType({
name : 'PokemonType',
fields : {
id : {
type : graphql.GraphQLString
'use strict';
const request = require('request-promise');
const path = require('path');
const Promise = require('bluebird');
const BASE_PATH = 'http://pokeapi.co/api/v2/';
function getPokemon(id) {
return request({
'use strict';
const graphql = require('graphql');
const chai = require('chai');
const pokemon = require('./pokemon');
const pokemonType = pokemon.type;
const expect = chai.expect;