0.0.1 • Published 7 years ago

ember-cli-graphql-file v0.0.1

Weekly downloads
3
License
BSD-3-Clause
Repository
github
Last release
7 years ago

ember-cli-graphql-file

An addon to precompile your .graphql files with graphql-tag and turn them into importable modules.

Installation

$ ember install ember-cli-graphql-file

Usage

Put your GraphQL query in a file

# app/graphql/query.graphql

query {
  hero {
    name

    friends {
      name
    }
  }
}

Import it from JS to execute it with Apollo

import Ember from 'ember';
import query from 'my-app/graphql/query';

export Ember.Route.extend({
  apollo: Ember.inject.service(),

  model() {
    return this.get('apollo').query({query});
  }
});