Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lucasconstantino/graphql-resolvers
:electric_plug: Resolver composition library for GraphQL.
https://github.com/lucasconstantino/graphql-resolvers
composition graphql resolver
Last synced: 9 days ago
JSON representation
:electric_plug: Resolver composition library for GraphQL.
- Host: GitHub
- URL: https://github.com/lucasconstantino/graphql-resolvers
- Owner: lucasconstantino
- License: mit
- Created: 2017-04-09T03:43:23.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T21:42:17.000Z (almost 2 years ago)
- Last Synced: 2024-04-13T17:05:33.659Z (7 months ago)
- Topics: composition, graphql, resolver
- Language: JavaScript
- Homepage:
- Size: 1.09 MB
- Stars: 283
- Watchers: 5
- Forks: 16
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# GraphQL Resolvers
Resolver composition library for GraphQL
[![build status](https://img.shields.io/travis/lucasconstantino/graphql-resolvers/master.svg?style=flat-square)](https://travis-ci.org/lucasconstantino/graphql-resolvers)
[![coverage](https://img.shields.io/codecov/c/github/lucasconstantino/graphql-resolvers.svg?style=flat-square)](https://codecov.io/github/lucasconstantino/graphql-resolvers)
[![npm version](https://img.shields.io/npm/v/graphql-resolvers.svg?style=flat-square)](https://www.npmjs.com/package/graphql-resolvers)
[![sponsored by Taller](https://raw.githubusercontent.com/TallerWebSolutions/tallerwebsolutions.github.io/master/sponsored-by-taller.png)](https://taller.net.br/en/)---
This library consists of simple *[but well tested](https://codecov.io/github/lucasconstantino/graphql-resolvers)* helper functions for combining other functions into more specialized ones.
## Installation
This package is available on [npm](https://www.npmjs.com/package/graphql-resolvers) as: *graphql-resolvers*
```
npm install graphql-resolvers
```> You should consider using [yarn](https://yarnpkg.com/), 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](https://github.com/acdlite/recompose)*, but for GraphQL resolvers.
## Documentation
[Read full documentation here](docs/API.md)
## Similar projects
Besides being inspired by some functional libraries out there, this project has some goals in common with other projects:
#### [apollo-resolvers](https://github.com/thebigredgeek/apollo-resolvers):
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](https://github.com/thebigredgeek/apollo-resolvers#resolver-context).
#### [graphql-tools](https://github.com/apollographql/graphql-tools)
At first, my idea was to [incorporate](https://github.com/apollographql/graphql-tools/issues/307) 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`](http://graphql.org/graphql-js/type/) too.