0.8.0 • Published 5 years ago

angular-neo4j v0.8.0

Weekly downloads
239
License
MIT
Repository
github
Last release
5 years ago

Neo4j Bolt driver wrapper for Angular

Use Neo4j Bolt driver for JavaScript from your Angular application. A special browser version of the driver supports connecting to Neo4j over WebSockets.

Installation

To install this library, run:

$ npm install angular-neo4j --save
import { AngularNeo4jModule } from 'angular-neo4j';

@NgModule({
  imports: [
    AngularNeo4jModule
  ]
})
export class AppModule { }

Usage

The module includes a service and a design-free component using this service: login form and query form. You are welcome to use this component as a foundation for your custom one.

The fastest way to test everything:

  <angular-neo4j></angular-neo4j>

Use the service in your own component:

  import { AngularNeo4jService } from './angular-neo4j.service';
  ...
  constructor(private neo4j: AngularNeo4jService) {}
  • connect( url: string, username: string, password: string, encrypted?: boolean ) - Connect to your Neo4j instance. Returns a promise with a driver instance.
  const url = 'bolt://localhost:7687';
  const username = 'neo4j';
  const password = 'neo4j';
  const encrypted = true;

  this.neo4j
      .connect(
        url,
        username,
        password,
        encrypted
      )
      .then(driver => {
        if (driver) {
          console.log(`Successfully connected to ${url}`);
        }
      });
  • run( query: string, params?: object) - Run the query with parameters. Returns a promise with array of records.
  const query = 'MATCH (n:USER {name: {name}}) RETURN n';
  const params = { name: 'bob' };

  this.neo4j.run(query, params).then(res => {
      console.log(res);
    });
  • disconnect() - Close the active driver.
  this.neo4j.disconnect()

Note on security

Do not hardcode your Neo4j username and password in the Angular app - always use login form to authenticate.

License

MIT © Maxim Salnikov

0.8.0

5 years ago

0.7.1

6 years ago

0.7.0

6 years ago

0.6.0

6 years ago

0.5.0

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago