Skip to content

Instantly share code, notes, and snippets.

@abernix
Last active April 8, 2021 10:08
Show Gist options
  • Save abernix/e5fc1b081b24250b74083f8e9a409d6e to your computer and use it in GitHub Desktop.
Save abernix/e5fc1b081b24250b74083f8e9a409d6e to your computer and use it in GitHub Desktop.
Apollo Gateway: Health Check: Schema Only
import { ApolloGateway } from "@apollo/gateway";
import { ApolloServer } from "apollo-server";
(async function startApolloServer() {
const gateway = new ApolloGateway({
/* Options, maybe! */
});
const server: ApolloServer = new ApolloServer({
gateway,
subscriptions: false,
onHealthCheck: () => server.executeOperation({ query: "{ __typename }" })
});
await server.listen();
})().catch(console.error);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment