Using neo4j in a custom database connection

Does anyone have an example of using neo4j as a custom database?

How did you import the neo4j driver?

I’m not aware of any examples for Neo4j and also according to the available modules to rules which would be equivalent to the ones for custom database scripts there is no Neo4j specific module available (did a search for neo4j). I know this is not the first time such a request as came up and I previously suggested that a Neo4j related module could be made available (I think it was the driver module you refer); I’ll recheck again what’s the status of that suggestion.

Meanwhile, an always available possibility is to just broker the access through an HTTP API and use one of the available HTTP client modules (for example request) to perform the outgoing calls to your service.

You can’t use the neo4j javascript driver since it is not currently supported by the webtask environment.
You can make use of request module to communicate with the neo4j REST API as an alternative.

The code below is a hook i created for test to create a node in my graphenedb database when a user signs up.

module.exports = function (user, context, cb) {

    const request = require('request');
       
    var username = 'dbusername';
    var password = 'dbpassword';
    var auth = new Buffer(dbusername+':'+dbpassword).toString('base64');
        
    var headersG = {
        'Accept': 'application/json',
        'Authorization': 'Basic '+auth,
        'Content-Type': 'application/json'
    };
  var bodyStuffG = {
    "statements" :  {
      "statement" : "CREATE (n:User{props}) RETURN n",
      "parameters" : {
        "props" : {
          "email" : user.email,
          'id': user.id
        }
      }
    } ]
};
  var options = {
      method: 'POST',
      url: 'https://hobby-hjifkhgdfhsdgbkeehdefaqs.dbs.graphenedb.com:24780/db/data/transaction/commit',
      headers: headersG,
      body:JSON.stringify(bodyStuffG)
    };
  
      request(options, function (error, response, body) {
          if(error){
            //hangle error
          }
         //do something with the body
      });
    cb();
  };