Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

connect-session-knex

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect-session-knex

Knex.js session store for Connect

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
68K
decreased by-0.53%
Maintainers
1
Weekly downloads
 
Created
Source

Connect Session Knex

connect-session-knex is a session store using knex.js, which is a SQL query builder for Postgres, MySQL, MariaDB and SQLite3.

Note: I could not get it to work with MariaDB using the mysql or mariadb drivers.

Installation

  $ npm install connect-session-knex

Options

  • tablename='sessions' Tablename to use. Defaults to 'sessions'.
  • knex knex instance to use. Defaults to a new knex instance, using sqlite3 with a file named 'connect-session-knex.sqlite'

Usage

With connect:

var connect = require('connect'),
    KnexSessionStore = require('connect-session-knex')(connect);

connect.createServer(
  connect.cookieParser(),
  connect.session({ store: new KnexSessionStore, secret: 'your secret' })
);

With express 3.x:

var KnexSessionStore = require('connect-session-knex')(express);

app.configure(function() {
  app.use(express.session({
    store: new KnexSessionStore,
    secret: 'your secret',
    cookie: { maxAge: 7 * 24 * 60 * 60 * 1000 } // 1 week
  }));
});

With express 4.x:

var session = require('express-session');
var KnexSessionStore = require('connect-session-knex')(session);

app.use(express.session({
  store: new KnexSessionStore,
  secret: 'your secret',
  cookie: { maxAge: 7 * 24 * 60 * 60 * 1000 } // 1 week
}));

Benchmarks

Insert 10,000 sessions

Sqlite 3

connect-session-knex with sqlite3: 16,128 ms

connect-sqlite3: 6,829 ms

PostgreSQL 9.3

connect-session-knex v0.0.1: 8,921 ms

connect-session-knex v0.0.2: 3,686 ms

connect-pgsql 2,255 ms

Redis

connect-redis: 330 ms

Cassandra

connect-cassandra-cql v0.1.4: 2,640ms

FAQs

Package last updated on 20 Nov 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc