Skip to content

Latest commit

 

History

History
42 lines (24 loc) · 2.73 KB

README.md

File metadata and controls

42 lines (24 loc) · 2.73 KB

GraphQL Resolvers

Resolver composition library for GraphQL

build status coverage npm version sponsored by Taller


This library consists of simple but well tested helper functions for combining other functions into more specialized ones.

Installation

This package is available on npm as: graphql-resolvers

npm install graphql-resolvers

You should consider using yarn, though.

Motivation

Many times we end-up repeating lots of logic on our resolvers. Access control, for instance, is something that can be done in the resolver level but just tends to end up with repeated code, even when creating services for such a task. This package aims to make it easier to build smart resolvers with logic being reusable and split in small pieces. Think recompose, but for GraphQL resolvers.

Documentation

Read full documentation here

Similar projects

Besides being inspired by some functional libraries out there, this project has some goals in common with other projects:

While graphql-resolvers follows the functional paradigm, apollo-resolvers project solves some problems using an opinionated and OOP approach. Furthermore, the second also solves other problems which graphql-resolvers does not intend to work on, such as solving circular references on the resolver's context.

At first, my idea was to incorporate the combineResolvers method into the wider project graphql-tools. That may yet happen some day, but I think people my not want to install the whole graphql-tools project when wanting this simple package's helper on their projects. Also, combineResolvers should work pretty fine with resolvers binded into graphql/types too.