Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit 33dc142

Browse files
committed
add comments
1 parent 32ae003 commit 33dc142

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

server/app.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,7 @@ if (process.env.CORS) {
2323

2424
const router = new koaRouter();
2525

26-
if (process.env.VOYAGER) {
27-
router.all(`/${voyagerPath}`, koaMiddleware({
28-
endpointUrl: `/${graphqlPath}`,
29-
displayOptions: {
30-
sortByAlphabet: true,
31-
},
32-
}));
33-
}
34-
26+
// GraphQL
3527
const graphqlMiddleware = graphqlKoa({
3628
schema,
3729
tracing: Boolean(process.env.GRAPHQL_TRACING),
@@ -45,10 +37,22 @@ const graphqlMiddleware = graphqlKoa({
4537
router.post(`/${graphqlPath}*`, koaBodyparser(), graphqlMiddleware);
4638
router.get(`/${graphqlPath}*`, graphqlMiddleware);
4739

40+
// GraphQL Voyager
41+
if (process.env.VOYAGER) {
42+
router.all(`/${voyagerPath}`, koaMiddleware({
43+
endpointUrl: `/${graphqlPath}`,
44+
displayOptions: {
45+
sortByAlphabet: true,
46+
},
47+
}));
48+
}
49+
50+
// GraphiQL
4851
if (process.env.GRAPHIQL) {
4952
router.get(`/${graphiqlPath}`, graphiqlKoa({ endpointURL: `/${graphqlPath}` }));
5053
}
5154

55+
// GraphQL Playground
5256
if (process.env.PLAYGROUND) {
5357
router.all(
5458
`/${playgroundPath}`,
@@ -58,7 +62,9 @@ if (process.env.PLAYGROUND) {
5862
);
5963
}
6064

65+
// Koa Heartbeat
6166
app.use(koaHeartbeat({ path: '/healthz', body: 'up!' }));
67+
6268
app.use(router.routes());
6369
app.use(router.allowedMethods());
6470

server/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'source-map-support/register';
22
import env from './env';
3-
43
process.env = env;
4+
55
import chalk from 'chalk';
66
import app from './app';
77
import { graphiqlPath, voyagerPath, playgroundPath } from './paths';

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"pretty": true,
1515
"strictNullChecks": true,
1616
"sourceMap": true,
17-
"lib": ["ESNext"]
17+
"lib": ["esnext"]
1818
},
1919
"exclude": [
2020
"node_modules",

0 commit comments

Comments
 (0)