reactioncommerce / reaction-feature-requests

Reaction Feature Requests
13 stars 1 forks source link

Extend ReactionAPICore in api-core plugin to allow user defined options to be supplied to createApolloServer #129

Open jmaver-plume opened 4 years ago

jmaver-plume commented 4 years ago

Use case: We want to add custom health check for apollo server as described here: https://www.apollographql.com/docs/apollo-server/monitoring/health-checks/

const server = new ApolloServer({
  typeDefs,
  resolvers,
  onHealthCheck: () => {    return new Promise((resolve, reject) => {      // Replace the `true` in this conditional with more specific checks!      if (true) {        resolve();      } else {        reject();      }    });  },});

Description:

Here is definition for ReactionAPICore: https://github.com/reactioncommerce/api-core/blob/trunk/src/ReactionAPICore.js#L110 Here new ApolloServer is created: https://github.com/reactioncommerce/api-core/blob/de2e924ae68247c08f690fbbd3fc9f678f4f45ec/src/createApolloServer.js#L73

Solution:

Extend ReactionAPICore constructor to allow for additional option key ApolloServerOptions. And then pass those options down to the new ApolloServer call.

If feature is approved we can start working on it asap.