You should be familiar with graph database concepts and the property graph model. You should have installed Neo4j and made yourself familiar with our Cypher Query language.
The standalone Neo4j-Server can be installed on any machine and then accessed via its HTTP API.
Below we show how you can use something as simple as the
request module to send queries to and receive responses from Neo4j.
You can also choose to leverage one of the existing drivers for Neo4j which wrap that protocol in a more convenient API for you.
Follow the tips below to get you started.
The Example Project
The Neo4j example project is a small, one page webapp for the movies database built into the Neo4j tutorial. The front-end page is the same for all drivers: movie search, movie details, and a graph visualization of actors and movies. Each backend implementation shows you how to connect to Neo4j from each of the different languages and drivers.
Using the HTTP-Endpoint directly
You can use something as simple as the
request node-module to send queries to and receive responses from Neo4j.
The endpoint protocol and formats are explained in detail in the Neo4j Manual.
It enables you do to much more, e.g. sending many statements per request or keeping transactions open across multiple requests.
Here is a very simple example:
- Cypher queries, parameters, batching, and transactions
- Arbitrary HTTP requests, for custom Neo4j plugins
- Custom headers, for high availability, application tracing, query logging, and more
- Precise errors, for robust error handling from the start
- Configurable connection pooling, for performance tuning & monitoring
- Thorough test coverage with >100 tests
- Continuously integrated against multiple versions of Node.js and Neo4j
Neo4j cypher queries as node object streams.
Transactions are duplex streams that allow you to write query statements then commit or roll back the written queries.
To get a stream per statement, just pass a callback function with the statement object. This works for regular cypher calls and transactions.
Seraph is a comprehensive, well documented driver for Neo4j, which supports all Neo4j features and provides not only Neo4j connection support, but extensive lifecycle handling. The additional extensions seraph-model and seraph-resource allow you to quickly load and persist your models and integrate seraph-model resolution into your express routes with a base-controller for CRUD operations. With disposable-seraph you can manage a disposable Neo4j-instance for automatic testing.
Chet and Sam Corcos created the
ccorcos:neo4j package that integrates Meteor well with Neo4j including reactivity and query-reevaluation on data changes.
Both wrote and presented about it and Chet provided insight into an example application for event feeds, written with Meteor and Neo4j as a stack.
Ostrio – Meteor.js – Driver
Dmitriy wrapped node-neo4j to be usable with Meteor and also provided a pseudo-reactive driver to support the life-query functionality.
A Neo4j driver for Dart. Both a simple driver and an OGM (Object Graph Mapper) is provided in separate libraries.
Neo4j REST API wrapper for Node.js Well maintained library, has been around since 2012.
- neo4j-js on GitHub
- Author: Bret Copeland
Node.js driver for the embedded Neo4j Database, it accesses the datatabase API through the JVM-integration directly. Also supports HA Setups.
- node-neo4j-embedded on GitHub
- Author: Jochen Weis