Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
This is a Node.js driver for Neo4j, a graph database.
This driver has undergone a complete rewrite for Neo4j v2. It now only supports Neo4j 2.x — but it supports it really well. (If you're still on Neo4j 1.x, you can still use node-neo4j v1.)
npm install neo4j --save
var neo4j = require('neo4j');
var db = new neo4j.GraphDatabase('http://localhost:7474');
db.cypher({
query: 'MATCH (u:User {email: {email}}) RETURN u',
params: {
email: 'alice@example.com',
},
}, function (err, results) {
if (err) throw err;
var result = results[0];
if (!result) {
console.log('No user found.');
} else {
var user = result['u'];
console.log(JSON.stringify(user, null, 4));
}
});
Yields e.g.:
{
"_id": 12345678,
"labels": [
"User",
"Admin"
],
"properties": {
"name": "Alice Smith",
"email": "alice@example.com",
"emailVerified": true,
"passwordHash": "..."
}
}
Node.js is asynchronous, which means this library is too: most functions take callbacks and return immediately, with the callbacks being invoked when the corresponding HTTP requests and responses finish.
Because async flow in Node.js can be quite tricky to handle, we strongly recommend using a flow control tool or library to help. Our personal favorite is Streamline.js, but other popular choices are async, Step, Seq, TameJS and IcedCoffeeScript.
Once you've gotten the basics down, skim through the full
API documentation to see what this library can do, and take a
look at @aseemk's node-neo4j-template app for a complete usage
example. (The models/User.js
file in particular is the one that interacts
with this library.)
This library is officially stable at "v1", but "v2" will almost certainly have
breaking changes to support only Neo4j 2.0 and generally improve the API
(roadmap). You can be sheltered from these changes if you simply specify
your package.json dependency as e.g. 1.x
or ^1.0
instead of *
.
git clone git@github.com:thingdom/node-neo4j.git
cd node-neo4j
npm install && npm run clean
You'll need a local installation of Neo4j (links),
and it should be running on the default port of 7474 (neo4j start
).
To run the tests:
npm test
This library is written in CoffeeScript, using Streamline.js syntax.
The tests automatically compile the code on-the-fly, but you can also generate
compiled .js
files from the source ._coffee
files manually:
npm run build
This is in fact what's run each time this library is published to npm.
But please don't check the generated .js
files in; to remove:
npm run clean
When compiled .js
files exist, changes to the source ._coffee
files will
not be picked up automatically; you'll need to rebuild.
If you npm link
this module into another app (like node-neo4j-template)
and you want the code compiled on-the-fly during development, you can create
an index.js
file under lib/
with the following:
require('coffee-script/register');
require('streamline/register');
module.exports = require('./index._coffee');
But don't check this in! That would cause all clients to compile the code on-the-fly every time, which isn't desirable in production.
See the Changelog for the full history of changes and releases.
This library is licensed under the Apache License, Version 2.0.
If you encounter any bugs or other issues, please file them in the issue tracker.
We also now have a Google Group! Post questions and participate in general discussions there.
FAQs
Neo4j driver (REST API client) for Node.js
The npm package neo4j receives a total of 268 weekly downloads. As such, neo4j popularity was classified as not popular.
We found that neo4j demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.