Added graphql docs endpoint.

This commit is contained in:
Wyatt Johnson
2017-02-08 17:41:28 -07:00
parent fb9bedc57b
commit 25103630b5
7 changed files with 115 additions and 7 deletions
+5
View File
@@ -94,6 +94,11 @@ if (app.get('env') !== 'production') {
endpointURL: '/api/v1/graph/ql'
}));
// GraphQL documention.
app.get('/admin/docs', (req, res) => {
res.render('admin/docs');
});
}
//==============================================================================
+11
View File
@@ -0,0 +1,11 @@
import React from 'react';
import ReactDOM from 'react-dom';
import {GraphQLDocs} from 'graphql-docs';
import fetcher from './services/fetcher';
// Render the application into the DOM
ReactDOM.render(<div className='wrapper'>
<h1>Talk: GraphQL Docs</h1>
<GraphQLDocs fetcher={fetcher} />
</div>, document.querySelector('#root'));
+10
View File
@@ -0,0 +1,10 @@
export default function fetcher(query) {
return fetch(`${window.location.origin}/api/v1/graph/ql`, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({query}),
}).then((res) => res.json());
}
+2
View File
@@ -64,6 +64,7 @@
"express": "^4.14.0",
"express-session": "^1.14.2",
"graphql": "^0.8.2",
"graphql-errors": "^2.1.0",
"graphql-server-express": "^0.5.0",
"graphql-tag": "^1.2.3",
"graphql-tools": "^0.9.0",
@@ -120,6 +121,7 @@
"eslint-plugin-standard": "^2.0.1",
"exports-loader": "^0.6.3",
"fetch-mock": "^5.5.0",
"graphql-docs": "^0.2.0",
"hammerjs": "^2.0.8",
"ignore-styles": "^5.0.1",
"immutable": "^3.8.1",
+34
View File
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Talk: GraphQL Docs</title>
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
<style media="screen">
body, #root {
width: 100%;
height: 100%;
margin: 0;
background-color: #FAFAFA;
font-family: 'Roboto', sans-serif;
}
.wrapper {
margin: 0 auto;
max-width: 800px;
}
a {
border-bottom: 2px dotted #f67150;
color: #333 !important;
text-decoration: none;
font-weight: bold;
}
</style>
</head>
<body>
<div id="root"></div>
<div id="root"></div>
<script src="/client/coral-docs/bundle.js" charset="utf-8"></script>
</body>
</html>
+2 -1
View File
@@ -7,7 +7,8 @@ const webpack = require('webpack');
// Edit the build targets and embeds below.
const buildTargets = [
'coral-admin'
'coral-admin',
'coral-docs'
];
const buildEmbeds = [
+51 -6
View File
@@ -1011,7 +1011,7 @@ babel-register@^6.22.0:
mkdirp "^0.5.1"
source-map-support "^0.4.2"
babel-runtime@^6.11.6, babel-runtime@^6.18.0, babel-runtime@^6.2.0, babel-runtime@^6.22.0:
babel-runtime@^6.11.6, babel-runtime@^6.18.0, babel-runtime@^6.2.0, babel-runtime@^6.22.0, babel-runtime@^6.6.1:
version "6.22.0"
resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.22.0.tgz#1cf8b4ac67c77a4ddb0db2ae1f74de52ac4ca611"
dependencies:
@@ -3307,6 +3307,21 @@ graphql-anywhere@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/graphql-anywhere/-/graphql-anywhere-2.1.0.tgz#888c0a1718db3ff866b313070747777380560f69"
graphql-docs@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/graphql-docs/-/graphql-docs-0.2.0.tgz#cf803f9c9d354fa03e89073d74e419261a5bfa74"
dependencies:
marked "^0.3.5"
request "^2.74.0"
yargs "^5.0.0"
graphql-errors@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/graphql-errors/-/graphql-errors-2.1.0.tgz#831c8c491b354859ee7a0c07bff101af64731195"
dependencies:
babel-runtime "^6.6.1"
uuid "^2.0.2"
graphql-server-core@^0.5.2:
version "0.5.2"
resolved "https://registry.yarnpkg.com/graphql-server-core/-/graphql-server-core-0.5.2.tgz#7e23fc516cb754e42c16f92928b595c354d6c8a7"
@@ -4480,7 +4495,7 @@ lodash.assign@^3.0.0:
lodash._createassigner "^3.0.0"
lodash.keys "^3.0.0"
lodash.assign@^4.0.3, lodash.assign@^4.0.6:
lodash.assign@^4.0.3, lodash.assign@^4.0.6, lodash.assign@^4.1.0, lodash.assign@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7"
@@ -4696,6 +4711,10 @@ map-stream@~0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/map-stream/-/map-stream-0.1.0.tgz#e56aa94c4c8055a16404a0674b78f215f7c8e194"
marked@^0.3.5:
version "0.3.6"
resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.6.tgz#b2c6c618fccece4ef86c4fc6cb8a7cbf5aeda8d7"
material-design-lite@^1.2.1:
version "1.3.0"
resolved "https://registry.yarnpkg.com/material-design-lite/-/material-design-lite-1.3.0.tgz#d004ce3fee99a1eeb74a78b8a325134a5f1171d3"
@@ -6707,7 +6726,7 @@ repeating@^2.0.0:
dependencies:
is-finite "^1.0.0"
request@2.79.0, request@^2.55.0, request@^2.79.0:
request@2.79.0, request@^2.55.0, request@^2.74.0, request@^2.79.0:
version "2.79.0"
resolved "https://registry.yarnpkg.com/request/-/request-2.79.0.tgz#4dfe5bf6be8b8cdc37fcf93e04b65577722710de"
dependencies:
@@ -7286,7 +7305,7 @@ supports-color@1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-1.2.0.tgz#ff1ed1e61169d06b3cf2d588e188b18d8847e17e"
supports-color@3.1.2:
supports-color@3.1.2, supports-color@^3.1.0:
version "3.1.2"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5"
dependencies:
@@ -7300,7 +7319,7 @@ supports-color@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
supports-color@^3.1.0, supports-color@^3.1.2, supports-color@^3.2.3:
supports-color@^3.1.2, supports-color@^3.2.3:
version "3.2.3"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6"
dependencies:
@@ -7658,7 +7677,7 @@ utils-merge@1.0.0, utils-merge@1.x.x:
version "1.0.0"
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.0.tgz#0294fb922bb9375153541c4f7096231f287c8af8"
uuid@^2.0.1, uuid@^2.0.3:
uuid@^2.0.1, uuid@^2.0.2, uuid@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a"
@@ -7908,6 +7927,13 @@ yargs-parser@^2.4.1:
camelcase "^3.0.0"
lodash.assign "^4.0.6"
yargs-parser@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-3.2.0.tgz#5081355d19d9d0c8c5d81ada908cb4e6d186664f"
dependencies:
camelcase "^3.0.0"
lodash.assign "^4.1.0"
yargs-parser@^4.2.0:
version "4.2.1"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-4.2.1.tgz#29cceac0dc4f03c6c87b4a9f217dd18c9f74871c"
@@ -7933,6 +7959,25 @@ yargs@^4.0.0:
y18n "^3.2.1"
yargs-parser "^2.4.1"
yargs@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-5.0.0.tgz#3355144977d05757dbb86d6e38ec056123b3a66e"
dependencies:
cliui "^3.2.0"
decamelize "^1.1.1"
get-caller-file "^1.0.1"
lodash.assign "^4.2.0"
os-locale "^1.4.0"
read-pkg-up "^1.0.1"
require-directory "^2.1.1"
require-main-filename "^1.0.1"
set-blocking "^2.0.0"
string-width "^1.0.2"
which-module "^1.0.0"
window-size "^0.2.0"
y18n "^3.2.1"
yargs-parser "^3.2.0"
yargs@^6.0.0:
version "6.6.0"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-6.6.0.tgz#782ec21ef403345f830a808ca3d513af56065208"