1.0.3 • Published 4 years ago

@hortau/ember-cli-graphql-file v1.0.3

Weekly downloads
4
License
BSD-3-Clause
Repository
github
Last release
4 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});
  }
});

License

ember-cli-graphql-file is © 2017 Mirego and may be freely distributed under the New BSD license. See the LICENSE.md file.

About Mirego

Mirego is a team of passionate people who believe that work is a place where you can innovate and have fun. We're a team of talented people who imagine and build beautiful Web and mobile applications. We come together to share ideas and change the world.

We also love open-source software and we try to give back to the community as much as we can.