I'm trying to work neo4j-spatial using the db.http interface but getting an error. My code:
var neo4j = require('neo4j');
neodb = new neo4j.GraphDatabase( {url: 'http://neo4j:pwd@localhost:7474'} );
var p = '/db/data/ext/SpatialPlugin/graphdb/addSimplePointLayer';
var h = 'Content-Type:application/json';
var b = {layer:'geom',lat:'lat',lon:'lon'};
var cb = function(err, body){ if (err){ throw err; } console.log(body); }
//this works: neodb.http({ method: 'GET', path: '/db/data/node/1234', body:{} }, cb);
neodb.http({ method:'POST', path:p, headers:h, body:b, raw:true }, cb)
The GET node works fine, but the POST to the SpatialPlugin fails somewhere in requestjs:
Object.keys(obj).forEach(function (i) {
TypeError: Object.keys called on non-object
at Function.keys (native)
at copy (/home/hierozbosch/gcrt2neo/node_modules/neo4j/node_modules/request/lib/helpers.js:51:10)
at Request.init (/home/hierozbosch/gcrt2neo/node_modules/neo4j/node_modules/request/request.js:162:33)
at new Request (/home/hierozbosch/gcrt2neo/node_modules/neo4j/node_modules/request/request.js:140:8)
at request (/home/hierozbosch/gcrt2neo/node_modules/neo4j/node_modules/request/index.js:55:10)
at GraphDatabase.module.exports.GraphDatabase.http (/home/hierozbosch/gcrt2neo/node_modules/neo4j/lib-new/GraphDatabase.js:76:14)
at Object.<anonymous> (/home/hierozbosch/gcrt2neo/spatial.js:10:7)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)