INNER CODE UNIT · JavaScript

fetchRemoteSDL

gmac/schema-stitching-handbook · combining-local-and-remote-schemas/index.js:73

async function fetchRemoteSDL(executor, context) {
  const result = await executor({ document: '{ _sdl }', context });
  return result.data._sdl;
}

waitOn({ resources: ['tcp:4001', 'tcp:4002'] }, async () => {
  const schema = await makeGatewaySchema();
  const app = express();
  app.use('/graphql', graphqlHTTP((req) => ({
    schema,
    context: { authHeader: req.headers.authorization },
    graphiql: true
  })));
  app.listen(4000, () => console.log('gateway running at http://localhost:4000/graphql'));
});

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…