Skip to content

Implementation of the session storage in Apache Cassandra as express middleware.

License

Notifications You must be signed in to change notification settings

astuanax/cassandra-store

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cassandra-store

NPM Version NPM Downloads Node

Implementation of the session storage in Apache Cassandra as an extension of the express-session middleware. This version has been fully updated to ES6 and Node.js >= 6.0.0. For backwards compatibility, use older versions of the package.

Installation

$ npm install [-g] cassandra-store

Options

{
    "table": "sessions",
    "client": null,
    "clientOptions": {
        "contactPoints": [ "localhost" ],
        "keyspace": "tests",
        "queryOptions": {
            "prepare": true
        }
    }
}

If client is null or undefined, a new Cassandra client will be created. Client options come from the Cassandra client driver (version 3.x).

Configuring the database

To create the table in the Cassandra database, you need the execute the following CQL commands:

USE tests;

DROP TABLE IF EXISTS sessions;

CREATE TABLE IF NOT EXISTS sessions (
   sid text,
   session text,
   expires timestamp,
   PRIMARY KEY(sid)
);

Debugging

To activate debugging, set the environment variable NODE_DEBUG:

$ export NODE_DEBUG=cassandra-store

Testing

See test/README.md

Usage

Usage within express:

const session = require("express-session");
const CassandraStore = require("cassandra-store");

app.use(session({
    store: new CassandraStore(options),
    ...
}));

Major changes

  • Updated to ES6 and Node.js >= 6.0.0
  • Removed dependencies on external packages uuid and debug

About

Implementation of the session storage in Apache Cassandra as express middleware.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%