express-session-sqlite
SQLite-backed session store for express-session written in Typescript
Last updated 25 days ago by gravity.bot .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install express-session-sqlite 
SYNC missed versions from official npm registry.

express-session-sqlite

npm version built with typescript JavaScript Style Guide CircleCI

A session store for express-session using SQLite.

Fully unit tested. PRs welcomed.

Install

$ npm i express-session-sqlite sqlite3 --save

Usage

import * as sqlite3 from 'sqlite3'
import * as express from 'express'
import * as session from 'express-session'
import sqliteStoreFactory from 'express-session-sqlite'

const SqliteStore = sqliteStoreFactory(session)
const app = express()

app.use(session({
    store: new SqliteStore({
      // Database library to use. Any library is fine as long as the API is compatible
      // with sqlite3, such as sqlite3-offline
      driver: sqlite3.Database,
      // for in-memory database
      // path: ':memory:'
      path: '/tmp/sqlite.db',
      // Session TTL in milliseconds
      ttl: 1234,
      // (optional) Session id prefix. Default is no prefix.
      prefix: 'sess:',
      // (optional) Adjusts the cleanup timer in milliseconds for deleting expired session rows.
      // Default is 5 minutes.
      cleanupInterval: 300000
    }),
    //... don't forget other expres-session options you might need
}))

Debugging

This module uses debug under the name express-session-sqlite. When starting up your app, do the following:

$ DEBUG=express-session-sqlite node app.js

Current Tags

  • 2.0.7                                ...           latest (25 days ago)

12 Versions

  • 2.0.7                                ...           25 days ago
  • 2.0.6                                ...           3 months ago
  • 2.0.5                                ...           6 months ago
  • 2.0.4                                ...           6 months ago
  • 2.0.3                                ...           7 months ago
  • 2.0.2                                ...           7 months ago
  • 2.0.1                                ...           7 months ago
  • 1.0.5                                ...           7 months ago
  • 1.0.4                                ...           7 months ago
  • 1.0.3                                ...           7 months ago
  • 1.0.2                                ...           7 months ago
  • 1.0.1                                ...           7 months ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 22
Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |