Skip to content

neo4j/hasura-ndc-neo4j

Repository files navigation

hasura-ndc-neo4j

To start the server:

  1. Make sure there is a configuration.json file at the root level. The file should look like this:
{
  "neo4j_url": "neo4j://localhost:7687/neo4j",
  "neo4j_user": "",
  "neo4j_pass": ""
}

The config property is optional and if not configured, the server will introspect the Neo4j DB in order to create the GraphQL operations. To control the design of the GraphQL operations, the config property can be specified. An example can be found in the __tests__/data/configuration.json file.

  1. Run npm install

  2. Run npm start

To run the Hasura tests:

  1. Make sure the server is started by following the instructions above.

  2. Run cargo run --bin ndc-test -- test --endpoint http://localhost:8100 from the ndc-spec. More info can be found here.

To test the features of the connector by sending different requests and asserting the responses:

  1. Make sure the server is started in test mode. For this, follow the instructions above but run the npm run start:test command as the last step.

  2. Run npm run test

  3. Any new tests you want to run should be inside the __tests__/requests folder and should follow the schema described in the __tests__/data/configuration.json file

Development

Prerequisite: Steps 1-3 from https://hasura.io/docs/3.0/local-dev/#step-1-prerequisites

  1. Start server locally

  2. Make sure the connector URL is your local server URL

definition:
  name: neo4j_connector
  url:
    singleUrl:
      value: http://localhost:<PORT>

Deploy connector

  1. Start server locally

  2. Use Hasura extension to refresh connector, track collections, track relationships

  • only track Array relationships
  • rename relationships if necessary
  1. Start Hasura daemon: hasura3 daemon start

  2. Get Tunnel Endpoint

  • check if exists: hasura3 tunnel list
  • or create one: hasura3 tunnel create localhost:<PORT>
  1. Change connector URL to Tunnel Endpoint

  2. Deploy connector: hasura3 build create

  3. Run queries in Hasura Console using the latest build: https://console.hasura.io/project/grown-pegasus-6631