neo4jGraphQLBinding

Creates a GraphQL Binding for a Neo4j instance that uses the Neo4j-GraphQL extension.

Strategy

The current strategy is to create a schema using makeRemoteExecutableSchema from graphql-tools with your typeDefs and a custom Apollo Link. The binding is then created over this schema.

When you send a GraphQL request to a resolver that delegates to the binding, the link receives the operation, processes it to support various features, and finally uses the Neo4j Bolt driver to send the operation to your Neo4j instance as a Cypher query that calls a custom procedure provided by the Neo4j-GraphQL extension. Queries use the read-only graphql.query procedure and mutations use the read/write graphql.execute.

API Reference

  • typeDefs (required): Your GraphQL type definitions in SDL format.

  • driver(required): Your Neo4j driver instance (More info here).

  • log (default: false): Logs results from query or mutation operations.

  • indexConfig

    • use (default: 'cuid') Configures what method to use when generating id field values.

Example

import { neo4jGraphQLBinding } from 'neo4j-graphql-binding';

const binding = neo4jGraphQLBinding({
  typeDefs: typeDefs,
  driver: driver,
  log: true
});

const context = {
  neo4j: binding
  ...
};

Last updated