Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/webmaxru/angular-neo4j
Neo4j Bolt driver wrapper for Angular
https://github.com/webmaxru/angular-neo4j
angular cypher graph graph-database neo4j neo4j-driver
Last synced: 3 months ago
JSON representation
Neo4j Bolt driver wrapper for Angular
- Host: GitHub
- URL: https://github.com/webmaxru/angular-neo4j
- Owner: webmaxru
- Created: 2018-05-01T15:51:01.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T03:22:57.000Z (about 2 years ago)
- Last Synced: 2024-10-22T11:02:11.979Z (3 months ago)
- Topics: angular, cypher, graph, graph-database, neo4j, neo4j-driver
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/angular-neo4j
- Size: 2.2 MB
- Stars: 18
- Watchers: 6
- Forks: 6
- Open Issues: 30
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### 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:
```bash
$ npm install angular-neo4j --save
```
```js
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:
```html
```Use the service in your own component:
```javascript
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.
```javascriptconst 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.
```javascriptconst 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.
```javascript
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](mailto:[email protected])