https://github.com/redisgraph/redisgraph.js
A Javascript client for RedisGraph
https://github.com/redisgraph/redisgraph.js
cypher graphdatabase javascript-client redis redisgraph
Last synced: 6 months ago
JSON representation
A Javascript client for RedisGraph
- Host: GitHub
- URL: https://github.com/redisgraph/redisgraph.js
- Owner: RedisGraph
- License: bsd-3-clause
- Created: 2018-08-21T06:33:31.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-09-05T09:23:38.000Z (over 1 year ago)
- Last Synced: 2025-06-26T03:01:41.968Z (6 months ago)
- Topics: cypher, graphdatabase, javascript-client, redis, redisgraph
- Language: JavaScript
- Homepage: https://redisgraph.io
- Size: 11.1 MB
- Stars: 100
- Watchers: 7
- Forks: 25
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/RedisGraph/redisgraph.js)
[](https://circleci.com/gh/RedisGraph/redisgraph.js/tree/master)
[](https://github.com/RedisGraph/redisgraph.js/releases/latest)
[](https://badge.fury.io/js/redisgraph.js)
[](https://codecov.io/gh/RedisGraph/redisgraph.js)
[](https://snyk.io/test/github/RedisGraph/redisgraph.js?targetFile=package.json)
# redisgraph.js
[](https://forum.redislabs.com/c/modules/redisgraph)
[](https://discord.gg/gWBRT6P)
[RedisGraph](https://github.com/RedisLabsModules/redis-graph/) JavaScript Client - [API Docs](https://redisgraph.github.io/redisgraph.js/)
-------
## Deprecation notice
This library is deprecated. [node-redis](https://www.github.com/redis/node-redis). It's features have been merged into [node-redis](https://www.github.com/redis/node-redis). Please either install it from npm or the repository.
-----
## Installation
Installation is done using the
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
```bash
npm install redisgraph.js
```
For installing the latest snapshot use
```bash
npm install github:RedisGraph/redisgraph.js.git
```
## Overview
### Example: Using the JavaScript Client
```javascript
const RedisGraph = require("redisgraph.js").Graph;
let graph = new RedisGraph("social");
(async () =>{
await graph.query("CREATE (:person{name:'roi',age:32})");
await graph.query("CREATE (:person{name:'amit',age:30})");
await graph.query("MATCH (a:person), (b:person) WHERE (a.name = 'roi' AND b.name='amit') CREATE (a)-[:knows]->(b)");
// Match query.
let res = await graph.query("MATCH (a:person)-[:knows]->(:person) RETURN a.name");
while (res.hasNext()) {
let record = res.next();
console.log(record.get("a.name"));
}
console.log(res.getStatistics().queryExecutionTime());
// Match with parameters.
let param = {'age': 30};
res = await graph.query("MATCH (a {age: $age}) return a.name", param);
while (res.hasNext()) {
let record = res.next();
console.log(record.get("a.name"));
}
// Named paths matching.
res = await graph.query("MATCH p = (a:person)-[:knows]->(:person) RETURN p");
while (res.hasNext()) {
let record = res.next();
// See path.js for more path API.
console.log(record.get("p").nodeCount);
}
graph.deleteGraph();
graph.close();
})();
```
### Running tests
A simple test suite is provided, and can be run with:
```sh
$ npm test
```
The tests expect a Redis server with the RedisGraph module loaded to be available at localhost:6379
## License
redisgraph.js is distributed under the BSD3 license - see [LICENSE](LICENSE)
[npm-image]: https://img.shields.io/npm/v/express.svg
[npm-url]: https://npmjs.org/package/redisgraph.js