Skip to content

Latest commit

 

History

History
22 lines (18 loc) · 556 Bytes

section37.1.md

File metadata and controls

22 lines (18 loc) · 556 Bytes

Section 37.1: Hello world

For accessing Cassandra cassandra-driver module from DataStax can be used. It supports all the features and can be easily configured.

const cassandra = require("cassandra-driver");
const clientOptions = {
  contactPoints: ["host1", "host2"],
  keyspace: "test"
};

const client = new cassandra.Client(clientOptions);
const query = "SELECT hello FROM world WHERE name = ?";

client.execute(query, ["John"], (err, results) => {
  if (err) {
    return console.error(err);
  }
  console.log(results.rows);
});