graphql-prefab-resolvers
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

graphql-prefab-resolvers

Reduce resolver boilerplate by configuring resolvers through JSON

Installation

yarn add graphql-prefab-resolvers

Usage

import { compile } from 'graphql-prefab-resolvers'
import { addResolveFunctionsToSchema } from 'graphql-tools'

...

const resolversPath = path.resolve(__dirname, './resolvers')
addResolveFunctionsToSchema(schema, compile(resolversPath))

Adding custom resolvers

Basic Example:

import { addResolver } from 'graphql-prefab-resolvers'

const fooResolver = (options) => (obj, args, context, info) => 'foo'

addResolver('foo', fooResolver)

Demo

Take a look at the demo server to see just how easy setting up GraphQL using graphql-prefab-resolvers can be.

yarn demo

Package Sidebar

Install

npm i graphql-prefab-resolvers

Weekly Downloads

1

Version

0.2.1

License

MIT

Unpacked Size

1.13 MB

Total Files

448

Last publish

Collaborators

  • jdolle