Skip to content

Instantly share code, notes, and snippets.

@matthewmueller
Last active January 31, 2016 21:47
Show Gist options
  • Save matthewmueller/38103a4eb437970a55b3 to your computer and use it in GitHub Desktop.
Save matthewmueller/38103a4eb437970a55b3 to your computer and use it in GitHub Desktop.

One thing you could do is have something like, say Film.js:

exports.toString = `
  type Film {
    characters(): [Character]
  }
`

exports.characters = function (film, args) { ... }

Then in a root Schema.js:

var Schema = require('graph.ql')
var Film = require('./film.js')

Schema(`
  ${Film.toString()}
`, {
  Film: Film
}
@matthewmueller
Copy link
Author

A couple notes:

  • You may not need Film.toString() since it should coerce to a string by calling toString()
  • You may have to filter out the toString in the Film object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment