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
+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());
}