UNPKG

wages-ws

Version:

This server read data from a cassandra DB and provide services for MyWagesApp

27 lines (22 loc) 867 B
var cassandra = require('cassandra-driver'); var client = new cassandra.Client({ contactPoints: ['10.226.112.47'], keyspace: 'wfm'}); client.connect(function (err) { if (err) { client.shutdown(); return console.error('There was an error when connecting', err); } console.log('Connected to cluster with %d host(s): %j', client.hosts.length, client.hosts.keys()); console.log('Keyspaces: %j', Object.keys(client.metadata.keyspaces)); console.log('Shutting down'); client.shutdown(); }); client.execute('SELECT * FROM test', function (err, result) { if (err) { client.shutdown(); return console.error('There was while trying to retrieve data from system.local', err); } var row = result.rows; console.log('Obtained row: ', row); console.log('Shutting down'); client.shutdown(); });