Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GraphQL Module Integration #84

Open
tomdev10 opened this issue Nov 5, 2019 · 0 comments
Open

GraphQL Module Integration #84

tomdev10 opened this issue Nov 5, 2019 · 0 comments

Comments

@tomdev10
Copy link

tomdev10 commented Nov 5, 2019

Hi there. Really keen to try and integrate this awesome package with GraphQL Modules (https://graphql-modules.com/).

I'm wondering if you have any idea how to think about doing this? At the moment I have the below:

But I need to pass some kind of resolvers to the module...any thoughts? Or is this likely to be incompatible?

I think it's a case of swapping from using the graphqlHTTP method to modules...?

import { GraphQLModule } from '@graphql-modules/core';
import { graphql } from 'graphql-compose';
import { elasticApiFieldConfig } from 'graphql-compose-elasticsearch';

const { GraphQLSchema, GraphQLObjectType } = graphql;

const generatedSchema = new GraphQLSchema({
  query: new GraphQLObjectType({
    name: 'Query',
    fields: {
      elastic70: elasticApiFieldConfig({
        host: 'http://user:pass@localhost:9200',
        apiVersion: '_default',
        // log: 'trace',
      }),
    },
  }),
});

export const elasticGraphQLModule = new GraphQLModule({
  typeDefs: generatedSchema,
  imports: [],
});

export default elasticGraphQLModule;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant