使用node.js发布到Neo4j服务器

免责声明:这与我在这里问的另一个问题有关。 我被build议提出一个新的问题,而不是更新那个问题,我希望这是正确的。 如果不是,请让我知道并忽略这个问题。

我一直在尝试在Microsoft Azure中使用Neo4j,使用本教程 。 我创build了一个运行Linux和neo4j的虚拟机。 我知道他的工作很好,因为我已经能够通过Webpipe理员门户访问数据库,在那里我可以创build和删除条目。 但是,当我尝试使用node.js来插入元素时,问题来了。

这里是脚本的代码:

function insert(item, user, request) { //comment to trigger .js creation var neo4j = require('neo4j'); var db = new neo4j.GraphDatabase('http://<username>:<password>@neo4jmobile.cloudapp.net:7474'); var node = db.createNode({ name: item.name }); node.save(function (err, node) { if (err) { console.error('Error saving new node to database:', err); } else { console.log('Node saved to database with id:', node.id); } }); request.execute(); } 

我收到此错误消息:

 Error saving new node to database: { [Error: connect ETIMEDOUT] stack: [Getter/Setter], code: 'ETIMEDOUT', errno: 'ETIMEDOUT', syscall: 'connect', __frame: { name: 'GraphDatabase_prototype__getRoot__1', line: 76, file: '\\\\10.211.156.195\\volume-0-default\\bf02c8bd8f7589d46ba1\\4906fa4587734dd087df8e641513f602\\site\\wwwroot\\App_Data\\config\\scripts\\node_modules\\neo4j\\lib\\GraphDatabase.js', prev: { name: 'GraphDatabase_prototype_getServices__2', line: 99, file: '\\\\10.211.156.195\\volume-0-default\\bf02c8bd8f7589d46ba1\\4906fa4587734dd087df8e641513f602\\site\\wwwroot\\App_Data\\config\\scripts\\node_modules\\neo4j\\lib\\GraphDatabase.js', prev: [Object], active: false, offset: 5, col: 12 }, active: false, offset: 5, col: 12 }, rawStack: [Getter] } 

任何帮助,将不胜感激!

您的url仍然是错误的: http://<username>:<password>@http://neo4jmobile.cloudapp.net:7474应该是http://<username>:<password>@neo4jmobile.cloudapp.net:7474

在参考教程(这是很好的顺便说一句)他说:

 var db = new neo4j.GraphDatabase('http://<username>:<password>@<your neo url>.cloudapp.net:7474'); 

凡提到的主机名,即: neo4jmobile