Coder Social home page Coder Social logo

graphql-middleware-forward-binding's Introduction

graphql-middleware-forward-binding

CircleCI npm version

GraphQL Middleware plugin for forwarding request to GraphQL Bindings.

Usage

With GraphQL Yoga and Prisma

import { GraphQLServer } from 'graphql-yoga'
import { forward } from 'graphql-middleware-forward-binding'
import { Prisma } from 'prisma-binding'

const bindingForwardMiddleware = forward('Query', 'Mutation.createBasket')('db')

const server = GraphQLServer({
  typeDefs: 'generated-schema.graphql',
  resolvers: {},
  middlewares: [bindingForwardMiddleware],
  context: req => ({
    ...req,
    db: new Prisma({
      endpoint: 'https://eu1.prisma.sh/public-saberbow/prisma-yoga/dev',
      debug: true,
    }),
  }),
})

serve.start(() => `Server running on http://localhost:4000`)

API

function forward(types: string[])(database: string): IMiddleware

License

MIT @ Matic Zavadlal

graphql-middleware-forward-binding's People

Contributors

maticzav avatar renovate-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

akofman

graphql-middleware-forward-binding's Issues

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

File: renovate.json
Error type: The renovate configuration file contains some invalid settings
Message: Configuration option packageRules should be a list (Array)

How can I forward only subfields?

The example in the README uses this:

const bindingForwardMiddleware = forward('Query', 'Mutation')('db')

What if I only want to forward specific queries? Does the following work?

const bindingForwardMiddleware = forward('Query.myQuery', Query.anotherQuery')('db')

Support selective forwarding

hey @maticzav !
I just found this project and I really like it, because it solves one big pain point I have which is not having the auto-generated resolvers from prisma available at my graphql-yoga endpoint.
One problem I have is: I need the login, signup, etc. mutations from graphql-yoga, to get a working environment.
Could you try to implement some sort of "selective" forwarding, where not all mutations get forwarded?
Maybe you already implemented this and I missed the feature?
Thanks for the great work!

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • fix(deps): update dependency dot-prop to v4.2.1
  • fix(deps): update dependency graphql-binding to v2.0.1
  • fix(deps): update dependency graphql-binding to v2.5.2
  • chore(deps): update dependency @types/dot-prop to v5
  • chore(deps): update dependency @types/node to v20
  • chore(deps): update dependency ava to v6
  • chore(deps): update dependency graphql to v16
  • chore(deps): update dependency prettier to v3
  • chore(deps): update dependency tslint to v6
  • chore(deps): update dependency typescript to v5
  • fix(deps): update dependency dot-prop to v8
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

npm
package.json
  • dot-prop ^4.2.0
  • graphql-binding ^2.0.0
  • @types/dot-prop 4.2.0
  • @types/node 10.1.4
  • ava 0.25.0
  • graphql 0.13.2
  • graphql-middleware 1.3.3
  • prettier 1.12.1
  • prettier-check 2.0.0
  • semantic-release 15.5.5
  • tslint 5.10.0
  • tslint-config-prettier 1.13.0
  • tslint-config-standard 7.0.0
  • typescript 2.8.4
  • graphql-middleware ^1.3.2

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.