Using neo4j in a custom database connection

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();
  };