Skip to content
This repository has been archived by the owner on May 24, 2020. It is now read-only.

[DEPRECATED] A helper function to automatically generate a GraphQLSchema from Sequelize models.

Notifications You must be signed in to change notification settings

rpellerin/graphql-sequelize-schema-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DEPRECATED: unmaintained

graphql-sequelize-schema-generator

A helper function that automatically generates GraphQLSchema from Sequelize models.

npm version Build Status

js-standard-style

Installation

yarn add graphql-sequelize-schema-generator

or

npm install graphql-sequelize-schema-generator

Prerequisites

This package assumes you have graphql and sequelize already installed (both packages are declared as dependencies and peerDependencies).

Usage

var {generateModelTypes, generateSchema} = require('graphql-sequelize-schema-generator')
var models = require('./models')
var schema = generateSchema(models) // Generates the schema
// OR
var types = generateModelTypes(models)
var schema = generateSchema(models, types) // Generates the schema by reusing the types

Example with Express

var { GraphQLSchema } = require('graphql')
const express = require('express')
const graphqlHTTP = require('express-graphql')
const {generateSchema} = require('graphql-sequelize-schema-generator')
const models = require('./models')

var app = express()

app.use(
  '/graphql',
  graphqlHTTP({
    schema: new GraphQLSchema(generateSchema(models)),
    graphiql: true
  })
)

app.listen(8080, function() {
  console.log('RUNNING ON 8080')
})

About

[DEPRECATED] A helper function to automatically generate a GraphQLSchema from Sequelize models.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published