neo4j-architect
Functional constructor for Neo4j queries and their results.
Basically, this makes it easy to combine and chain neo4j queries together.
It will also return an array of all the cypher queries, params and results if you pass in {neo4j: true} or {queries: true}. Queries for use with Neo4j-Swagger.
Check out users.js for an implementation.
In use at Neo4j-Swagger.
Big plans, more to come! Pull-requests welcome!
Setup
// .env file NEO4J_URL=YOUR_NEO4J_URL // set the neo4j URL, only needs to be done once var Architect = ; Architect; // defaults: (url || process.env.NEO4J_URL || 'http://localhost:7474')
Model
// user.js var Architect = ; Architect; var Construct = ArchitectConstruct; // construct the cypher query and params var { var cypher_params = id: paramsid ; var query = 'MATCH (user:User)' 'WHERE user.id = {id}' 'RETURN user' ; ; } // extract the data from the cypher results var { if resultslength ; else ; } var getUser = ; var createUser = _createUserQuery _singleUserResult; var createUsers = moduleexports = getUser: getUser createUser: createUser createUsers: createUsers ;
Route
var Users = ; // set options to {neo4j: true} or {queries: true} to return all queries/results exports { Users; };
Links
License
MIT