GitHub

A Node.js driver for OrientDB using the OrientDB RESTful HTTP protocol.

npm install node-orientdb-http
var orientdb = require('node-orientdb-http');
var db = orientdb.connect({
    host: "http://localhost:2480",
    user: "admin",
    password: "admin",
    database: "test"
});
db.on('connect', function() {
    // yes! connected
});
db.on('error', function(err) {
    // mmm error ..
});
// general api
db.[get|post|put|delete](:command, :queryParams, :postBody).then(successHandler, errorHandler);
var d = { '@class': 'V', name: 'Robin'};
db.post('document', null, d).then(successHandler, errorHandler);
db.delete('document', '9:1').then(successHandler, errorHandler);
// or specific commands
db.command('insert into V set name = "Batman"').then(successHandler, errorHandler);
db.query('select * from V where name = "Batman"').then(successHandler, errorHandler);
db.language('gremlin').query("g.V('@class', 'User')").then(successHandler2, errorHandler2);

Read the original on github.com ↗