1
1
import path from 'path' ;
2
2
import express from 'express' ;
3
3
import { apolloExpress , graphiqlExpress } from 'apollo-server' ;
4
- import { makeExecutableSchema } from 'graphql-tools' ;
5
4
import bodyParser from 'body-parser' ;
6
5
7
6
import {
@@ -10,11 +9,12 @@ import {
10
9
} from './githubKeys' ;
11
10
12
11
import { setUpGitHubLogin } from './githubLogin' ;
13
- import { schema , resolvers } from './schema' ;
14
12
import { GitHubConnector } from './github/connector' ;
15
13
import { Repositories , Users } from './github/models' ;
16
14
import { Entries , Comments } from './sql/models' ;
17
15
16
+ import executableSchema from './schema' ;
17
+
18
18
let PORT = 3010 ;
19
19
if ( process . env . PORT ) {
20
20
PORT = parseInt ( process . env . PORT , 10 ) + 100 ;
@@ -27,11 +27,6 @@ app.use(bodyParser.json());
27
27
28
28
setUpGitHubLogin ( app ) ;
29
29
30
- const executableSchema = makeExecutableSchema ( {
31
- typeDefs : schema ,
32
- resolvers,
33
- } ) ;
34
-
35
30
app . use ( '/graphql' , apolloExpress ( ( req ) => {
36
31
// Get the query, the same way express-graphql does it
37
32
// https://github.com/graphql/express-graphql/blob/3fa6e68582d6d933d37fa9e841da5d2aa39261cd/src/index.js#L257
@@ -73,6 +68,17 @@ app.use('/graphql', apolloExpress((req) => {
73
68
74
69
app . use ( '/graphiql' , graphiqlExpress ( {
75
70
endpointURL : '/graphql' ,
71
+ query : `{
72
+ feed (type: NEW, limit: 5) {
73
+ repository {
74
+ owner { login }
75
+ name
76
+ }
77
+
78
+ postedBy { login }
79
+ }
80
+ }
81
+ ` ,
76
82
} ) ) ;
77
83
78
84
// Serve our helpful static landing page. Not used in production.
0 commit comments