How to use the express-cassandra.setDirectory function in express-cassandra

To help you get started, we’ve selected a few express-cassandra examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mengwangk / myInvestor / myInvestor-web / server / myinvestor.js View on Github external
function init() {
    // Tell express-cassandra to use the models-directory, and
    // use bind() to load the models using cassandra configurations.
    var host = config.get('cassandra.host');
    var port = config.get('cassandra.port');
    var keyspace = config.get('cassandra.keyspace');
    models.setDirectory(__dirname + '/models').bind({
        clientOptions: {
            contactPoints: [host],
            protocolOptions: { port: port },
            keyspace: keyspace,
            queryOptions: { consistency: models.consistencies.one }
        },
        ormOptions: {
            // If your keyspace doesn't exist it will be created automatically
            // using the default replication strategy provided here.
            defaultReplicationStrategy: {
                class: 'SimpleStrategy',
                replication_factor: 1
            },
            //migration: 'safe',
            migration: 'alter',
            createKeyspace: false
github Sunbird-Ed / SunbirdEd-portal / src / app / helpers / eCreds / cassandraUtil.js View on Github external
var _ = require('lodash');
var models = require('express-cassandra');
const envHelper = require('../environmentVariablesHelper');
const contactPoints = envHelper.PORTAL_CASSANDRA_URLS;
const keyspaceName = 'sunbird';
let isConnected = false;
const consistency = getConsistencyLevel(envHelper.PORTAL_CASSANDRA_CONSISTENCY_LEVEL);

models.setDirectory(__dirname + '/models').bind(
    {
        clientOptions: {
            contactPoints: contactPoints,
            keyspace: keyspaceName,
            queryOptions: { consistency: consistency }
        },
        ormOptions: {
            defaultReplicationStrategy: {
                class: 'SimpleStrategy',
                replication_factor: 1
            },
            migration: 'safe'
        }
    },
    function (err) {
        if (err) {

express-cassandra

Cassandra Object Models (ORM/ODM/OGM) for NodeJS with support for Apache Cassandra, ScyllaDB, Datastax Enterprise, Elassandra & JanusGraph.

LGPL-3.0
Latest version published 1 year ago

Package Health Score

51 / 100
Full package analysis