sequelize-relay

NPM

This is a library to allow the easy creation of Relay-compliant servers using sequelize, graphql-js and graphql-relay-js.

Fork me on GitHub

Dependencies:

  • sequelize - an easy-to-use multi sql dialect ORM for Node.js & io.js. It currently supports MySQL, MariaDB, SQLite, PostgreSQL and MSSQL.
  • graphql-relay-js - A library to help construct a graphql-js server supporting react-relay.
  • graphql-js - A reference implementation of GraphQL for JavaScript.

Getting Started

This library is designed to work with the graphql-relay-js implementation of a GraphQL server using Sequelize.

  1. Setup a new npm project
  2. Run npm install graphql graphql-relay-js sequelize sequelize-relay --save-dev
  3. Setup a Sequelize Server
  4. Setup your GraphQL Schema
  5. Use graphql-relay-js, sequelize, and sequelize-relay helper functions and win.
  6. Common Patterns, helper methods, etc in the References page.

Methods

  • getArrayData - Converts an Array of <SequelizeModel> instances to an Array of objects.

  • getModelsByClass - Returns an Array of <SequelizeModel> instances that are of the passed-in SequelizeClass.

  • resolveArrayByClass - First, it internally resolves an an Array of <SequelizeModel> instances that are of the passed-in SequelizeClass. Then it converts the array into a promised Array of <Attributes> objects.

  • resolveArrayData - Converts a promised Array of <SequelizeModel> instances into a promised Array of <Attributes> objects.

  • resolveModelsByClass - Returns a promised Array of <SequelizeModel> objects by SequelizeClass.

results matching ""

    No results matching ""