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 express from 'express'; | |
import { graphqlExpress, graphiqlExpress } from 'graphql-server-express'; | |
import bodyParser from 'body-parser'; | |
import cors from 'cors'; | |
import { createServer } from 'http'; | |
import { SubscriptionServer } from 'subscriptions-transport-ws'; | |
import { printSchema } from 'graphql/utilities/schemaPrinter'; | |
import { subscriptionManager } from './data/subscriptions'; | |
import schema from './data/schema'; |
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
"eslintConfig": { | |
"parser": "babel-eslint", | |
"extends": [ | |
"airbnb/base", | |
"plugin:import/errors" | |
], | |
"rules": { | |
"no-use-before-define": 0, | |
"arrow-body-style": 0, | |
"dot-notation": 0, |
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
{ | |
"name": "votemon-server", | |
"version": "0.1.0", | |
"description": "graphql server votemon", | |
"scripts": { | |
"start": "nodemon ./server.js --exec babel-node", | |
"test": "echo \"Error: no test specified\" && exit 1", | |
"lint": "eslint ." | |
}, | |
"main": "server.js", |
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
{ | |
"passPerPreset": true, | |
"presets": [ | |
"react", | |
"es2015", | |
"stage-0" | |
], | |
"plugins": [ | |
"babel-plugin-inline-import" | |
] |
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 } from 'graphql-tools'; | |
import resolvers from './resolvers'; | |
const schema = ` | |
type Type { | |
id: Int! # the ! means that every author object _must_ have an id | |
title: String | |
pokemons: [Pokemon] # the list of Posts by this author | |
} |
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 { PubSub, SubscriptionManager } from 'graphql-subscriptions'; | |
import schema from './schema'; | |
const pubsub = new PubSub(); | |
const subscriptionManager = new SubscriptionManager({ | |
schema, | |
pubsub, | |
}); | |
export { subscriptionManager, pubsub }; |
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 { find, filter } from 'lodash'; | |
import { pubsub } from './subscriptions'; | |
const types = [ | |
{ id: 1, title: 'Water' }, | |
{ id: 2, title: 'Electric' }, | |
]; | |
const pokemons = [ | |
{ id: 1, typeId: 1, name: 'Squirtle', image: 'https://img.pokemondb.net/artwork/squirtle.jpg', votes: 2 }, |
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
{ | |
"name": "votemon-client", | |
"version": "0.0.1", | |
"description": "votemon client reactjs codepolita.com", | |
"main": "index.js", | |
"repository": { | |
"url": "https://github.com/aligos/votemon-client.git", | |
"type": "git" | |
}, | |
"author": "Rahmat Aligos", |
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 lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>React App</title> | |
</head> | |
<body> | |
<div id="root"></div> | |
</body> |
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 React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import App from './App'; | |
ReactDOM.render( | |
<App/>, | |
document.getElementById('root') | |
); |
OlderNewer