egg-neo4j

1.0.3 • Public • Published

egg-neo4j

NPM version build status David deps Known Vulnerabilities npm download

Neo4j for egg framework.

Install

$ npm i egg-neo4j --save

Usage

// {app_root}/config/plugin.js
exports.neo4j = {
  enable: true,
  package: 'egg-neo4j',
};

Configuration

// {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.

Example

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

Questions & Suggestions

Please open an issue here.

PRs welcome!

License

MIT

Package Sidebar

Install

npm i egg-neo4j

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

5.38 kB

Total Files

7

Last publish

Collaborators

  • cemremengu