Neo4j for egg framework.
$ npm i egg-neo4j --save
// {app_root}/config/plugin.js
exports.neo4j = {
enable: true,
package: 'egg-neo4j',
};
// {app_root}/config/config.default.js
exports.neo4j = {
client: {
url: 'bolt://127.0.0.1',
username: 'neo4j',
password: 'admin',
},
};
see config/config.default.js for more detail.
Assume that we have User
nodes in our database and we want to fetch all of them:
async function all() {
const session = this.ctx.app.neo4j.session();
try {
const result = await session.run('MATCH(user:User) RETURN user');
return result.records.map((item) => item.get('user').properties);
} finally {
session.close();
}
}
Please open an issue here.
PRs welcome!