Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}));
}
// GraphiQL?
if (process.env.GRAPHIQL) {
router.get(
`/${paths.GRAPHIQL_PATH}`,
graphiqlKoa({ endpointURL: GRAPHQL_ENDPOINT }),
);
}
// GraphQL Playground?
if (process.env.PLAYGROUND) {
router.all(
`/${paths.PLAYGROUND_PATH}`,
koaPlayground({ endpoint: GRAPHQL_ENDPOINT }),
);
}
// Koa Heartbeat
app.use(koaHeartbeat({ path: `/${paths.LIVENESS_PATH}`, body: 'ok' }));
app.use(router.routes());
app.use(router.allowedMethods());
export default app;
]).then(([headers, endpoint]) => {
const app = new Koa();
app.use(koaPlayground({
endpoint,
settings: {
'editor.cursorShape': 'line',
'editor.reuseHeaders': true,
},
tabs: [{
endpoint,
headers,
}],
}));
const port = options.port || 3000;
app.listen(port);
const graphiqlUrl = `http://localhost:${port}`;
return graphiqlUrl;