Skip to content

Commit e2c51ab

Browse files
committed
graphql-server
2017-06-01 ------------------------------------------------------ * Adds `graphql-server` example
1 parent 3a156e1 commit e2c51ab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+10861
-0
lines changed

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[*]
2+
indent_style = space
3+
end_of_line = lf
4+
indent_size = 2
5+
charset = utf-8
6+
trim_trailing_whitespace = true
7+
insert_final_newline = true
8+
9+
[*.md]
10+
max_line_length = 0
11+
trim_trailing_whitespace = false

.gitignore

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Meta
2+
**/.DS_Store
3+
4+
# Logs
5+
**/logs
6+
**/*.log
7+
**/npm-debug.log*
8+
9+
# Runtime data
10+
**/pids
11+
**/*.pid
12+
**/*.seed
13+
14+
# Directory for instrumented libs generated by jscoverage/JSCover
15+
**/lib-cov
16+
17+
# Coverage directory used by tools like istanbul
18+
**/coverage
19+
20+
# nyc test coverage
21+
**/.nyc_output
22+
23+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24+
**/.grunt
25+
26+
# node-waf configuration
27+
**/.lock-wscript
28+
29+
# Compiled binary addons (http://nodejs.org/api/addons.html)
30+
**/build/Release
31+
32+
# Dependency directories
33+
**/node_modules
34+
**/jspm_packages
35+
36+
# Optional npm cache directory
37+
**/.npm
38+
39+
# Optional REPL history
40+
**/.node_repl_history
41+
42+
# Distribution
43+
**/dist

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2017-06-01
2+
------------------------------------------------------
3+
* Adds `graphql-server` example

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 Lee Benson
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ This flexibility makes the kit ideal for a variety of use cases -- from building
1212

1313
This repo features a growing list of runnable examples to demonstrate how ReactQL can be used.
1414

15+
## Projects
16+
17+
Current example projects:
18+
19+
### [GraphQL Server (graphql-server)](https://github.com/reactql/examples/blob/master/graphql-server)
20+
21+
Swaps out the [Graphcool](https://graph.cool) service for your own GraphQL server, running alongside the built-in Koa web server. Demonstrates a monolithic application, where the GraphQL endpoint 'lives' next to your front-end code.
22+
1523
## How to run
1624

1725
Each project appears in its own folder.

graphql-server/.babelrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"presets": [
3+
["env", {
4+
"targets": {
5+
"node": true
6+
}
7+
}]
8+
]
9+
}

graphql-server/.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[*]
2+
indent_style = space
3+
end_of_line = lf
4+
indent_size = 2
5+
charset = utf-8
6+
trim_trailing_whitespace = true
7+
insert_final_newline = true
8+
9+
[*.md]
10+
max_line_length = 0
11+
trim_trailing_whitespace = false

graphql-server/.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

graphql-server/.eslintrc.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
const path = require('path');
2+
const baseRules = require('eslint-config-airbnb-base/rules/style');
3+
const [_, ...restricted] = baseRules.rules['no-restricted-syntax'];
4+
5+
const PATHS = require('./config/paths');
6+
7+
module.exports = {
8+
extends: 'airbnb',
9+
parser: 'babel-eslint',
10+
parserOptions: {
11+
ecmaVersion: 2017,
12+
sourceType: 'module',
13+
jsx: true,
14+
},
15+
env: {
16+
node: true,
17+
browser: true,
18+
},
19+
plugins: [
20+
'babel',
21+
'import',
22+
'jsx-a11y',
23+
'compat',
24+
],
25+
rules: {
26+
'arrow-parens': ['error', 'as-needed'],
27+
'react/forbid-prop-types': [1, { forbid: ['any']} ],
28+
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
29+
'react/prefer-stateless-function': [2, { ignorePureComponents: true }],
30+
'react/no-multi-comp': 0,
31+
'react/jsx-closing-bracket-location': [1, 'after-props'],
32+
'linebreak-style': 0,
33+
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
34+
'no-restricted-syntax': [2,
35+
...restricted.filter(
36+
r => !['ForOfStatement'].includes(r.selector)
37+
),
38+
],
39+
'global-require': 0,
40+
'import/no-unresolved': [2, { commonjs: true }],
41+
'compat/compat': 2
42+
},
43+
settings: {
44+
'import/resolver': {
45+
node: {
46+
paths: [
47+
PATHS.root,
48+
'node_modules',
49+
],
50+
},
51+
},
52+
},
53+
globals: {
54+
SERVER: false,
55+
},
56+
};

graphql-server/.gitignore

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Meta
2+
**/.DS_Store
3+
4+
# Logs
5+
logs
6+
*.log
7+
npm-debug.log*
8+
9+
# Runtime data
10+
pids
11+
*.pid
12+
*.seed
13+
14+
# Directory for instrumented libs generated by jscoverage/JSCover
15+
lib-cov
16+
17+
# Coverage directory used by tools like istanbul
18+
coverage
19+
20+
# nyc test coverage
21+
.nyc_output
22+
23+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24+
.grunt
25+
26+
# node-waf configuration
27+
.lock-wscript
28+
29+
# Compiled binary addons (http://nodejs.org/api/addons.html)
30+
build/Release
31+
32+
# Dependency directories
33+
node_modules
34+
jspm_packages
35+
36+
# Optional npm cache directory
37+
.npm
38+
39+
# Optional REPL history
40+
.node_repl_history
41+
42+
# Distribution
43+
dist

0 commit comments

Comments
 (0)