Skip to content

Commit

Permalink
Update playground
Browse files Browse the repository at this point in the history
  • Loading branch information
AnnaNarra committed Nov 20, 2024
1 parent 9d417a6 commit debec62
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions qlkube/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,20 @@ async function main() {
app.get('/healthz', (req, res) => {
res.sendStatus(200);
});
app.get('/', (req, res) => {
res.setHeader('content-type', 'text/html');
res.send(`<html><head><title>CrownLabs GraphQL Playground</title></head><body>
<div></div>
<script src="https://embeddable-sandbox.cdn.apollographql.com/_latest/embeddable-sandbox.umd.production.min.js"></script>
<script>new window.EmbeddedSandbox({ target: 'div', initialEndpoint: document.location.href });</script>
<style>html, body, body > div {height: 100%;body: 100%;margin: 0;padding: 0}</style>
</body></html>`);
});

const httpServer = createServer(app);

const server = new ApolloServer({
schema,
playground: true,
plugins: [
ApolloServerPluginDrainHttpServer({ httpServer: httpServer }),
ApolloServerPluginLandingPageGraphQLPlayground(),
],
formatError: error => {
try {
const msgs = [...(error.message.match(/(\d+)\s*\-(.*)$/) || [])];
Expand Down

0 comments on commit debec62

Please sign in to comment.