ember-cli-graphql-file

0.0.1 • Public • Published

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({
  apolloEmber.inject.service(),
 
  model() {
    return this.get('apollo').query({query});
  }
});

/ember-cli-graphql-file/

    Package Sidebar

    Install

    npm i ember-cli-graphql-file

    Weekly Downloads

    0

    Version

    0.0.1

    License

    BSD-3-Clause

    Last publish

    Collaborators

    • mirego-dev