@@ -2,62 +2,60 @@ import React from 'react';
22import ReactDOM from 'react-dom' ;
33import { ApolloProvider } from 'react-apollo' ;
44import { ApolloClient } from 'apollo-client' ;
5- import { HttpLink } from 'apollo-link-http' ;
5+ // import { HttpLink } from 'apollo-link-http';
66import { InMemoryCache } from 'apollo-cache-inmemory' ;
77
88import { SchemaLink } from 'apollo-link-schema' ;
99import {
1010 makeExecutableSchema ,
11- introspectSchema ,
11+ // introspectSchema,
1212} from 'graphql-tools' ;
1313
14- import { printSchema } from 'graphql/utilities/schemaPrinter' ;
14+ // import { printSchema } from 'graphql/utilities/schemaPrinter';
1515
1616import App from './App' ;
17- import {
18- // schema,
19- resolvers ,
20- } from './schema' ;
17+ import { schema , resolvers } from './schema' ;
2118
2219import registerServiceWorker from './registerServiceWorker' ;
2320
24- async function render ( ) {
25- const cache = new InMemoryCache ( ) ;
26-
27- const GITHUB_BASE_URL = 'https://api.github.com/graphql' ;
28-
29- const httpLink = new HttpLink ( {
30- uri : GITHUB_BASE_URL ,
31- headers : {
32- authorization : `Bearer ${
33- process . env . REACT_APP_GITHUB_PERSONAL_ACCESS_TOKEN
34- } `,
35- } ,
36- } ) ;
37-
38- const schema = await introspectSchema ( httpLink ) ;
39-
40- const executableSchema = makeExecutableSchema ( {
41- typeDefs : printSchema ( schema ) ,
42- resolvers,
43- resolverValidationOptions : {
44- requireResolversForResolveType : false ,
45- } ,
46- } ) ;
47-
48- const client = new ApolloClient ( {
49- link : new SchemaLink ( { schema : executableSchema } ) ,
50- cache,
51- } ) ;
52-
53- ReactDOM . render (
54- < ApolloProvider client = { client } >
55- < App />
56- </ ApolloProvider > ,
57- document . getElementById ( 'root' ) ,
58- ) ;
59- }
60-
61- render ( ) ;
21+ // async function render() {
22+ const cache = new InMemoryCache ( ) ;
23+
24+ // const GITHUB_BASE_URL = 'https://api.github.com/graphql';
25+
26+ // const httpLink = new HttpLink({
27+ // uri: GITHUB_BASE_URL,
28+ // headers: {
29+ // authorization: `Bearer ${
30+ // process.env.REACT_APP_GITHUB_PERSONAL_ACCESS_TOKEN
31+ // }`,
32+ // },
33+ // });
34+
35+ // const schema = await introspectSchema(httpLink);
36+
37+ const executableSchema = makeExecutableSchema ( {
38+ // typeDefs: printSchema(schema),
39+ typeDefs : schema ,
40+ resolvers,
41+ // resolverValidationOptions: {
42+ // requireResolversForResolveType: false,
43+ // },
44+ } ) ;
45+
46+ const client = new ApolloClient ( {
47+ link : new SchemaLink ( { schema : executableSchema } ) ,
48+ cache,
49+ } ) ;
50+
51+ ReactDOM . render (
52+ < ApolloProvider client = { client } >
53+ < App />
54+ </ ApolloProvider > ,
55+ document . getElementById ( 'root' ) ,
56+ ) ;
57+ // }
58+
59+ // render();
6260
6361registerServiceWorker ( ) ;
0 commit comments