Skip to content

Compiler plugin that supports GraphQL files in Meteor

License

Notifications You must be signed in to change notification settings

lemccarthy/meteor-graphql

 
 

Repository files navigation

Meteor GraphQL

Compiler plugin that supports GraphQL files in Meteor

Build Status Greenkeeper badge

Installation

meteor add swydo:graphql

Usage

import query from './query.graphql';

// See https://github.com/apollographql/apollo-client for setup
const client = new ApolloClient();

// The query is parsed and can be directly passed to the Apollo Client
client.query({ query }).then(console.log);

You can also import your main schema and pass it directly to makeExecutableSchema:

import { makeExecutableSchema } from 'graphql-tools';

import typeDefs from './schema.graphql'; // No need to parse it!
import resolvers from './resolvers';

const schema = makeExecutableSchema({
  typeDefs,
  resolvers,
});

.graphql, .graphqls and .gql files are supported.

Benefits

There are some good reasons to use .graphql files instead of the inline syntax:

About

Compiler plugin that supports GraphQL files in Meteor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%