Skip to content

A graysql-orm-loader translator to load a GraphQL schema from Waterline.

Notifications You must be signed in to change notification settings

larsbs/graysql-orm-loader-waterline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Waterline Translator

This is a translator for graysql-orm-loader that will translate the models defined in Waterline to a valid GraphQL schema.

PD: If you want a simpler way to integrate this with a Sails.js application, take a look at sails-hook-graysql.

Installation

Install it from npm. Make sure to install its peer-dependencies as well.

$ npm install graysql-orm-waterline

Examples

Here is an example using Sails.js and Waterline.

const GraysQL = require('graysql');
const ORMLoader = require('graysql-orm-loader');
const WaterlineTranslator = require('graysql-orm-loader-waterline');

const GQL = new GraysQL();
GQL.use(ORMLoader);

GQL.loadFromORM(new WaterlineTranslator(sails.models));
const Schema = GQL.generateSchema();

Examples

Usage example can be found in example directory.

Tests

The tests are written with mocha and can be run with the following command:

$ npm test

To get code coverage reports, run the following command:

$ npm run cover

License

MIT

About

A graysql-orm-loader translator to load a GraphQL schema from Waterline.

Resources

Stars

Watchers

Forks

Packages

No packages published