express-sqlite3
v0.0.4
Published
SQLite3 session store for express-session
Downloads
12
Maintainers
Readme
express-sqlite3
SQLite3 session store for the express-session package.
Installation
npm i express-sqlite3
Options
| name | description | default value| | ------ | ----------- |:--------:| | db | Database file name | sessions | | dir | Database file directory | ./ | | mode | SQLite3 client mode option | | | table | Database table name | sessions | | maxAge | Sessions maximum age in msecs| 86400000 (One day) | | concurentDb | Enables WAL mode | false | | cleanupInterval | Interval for expired sessions cleanup in msecs | 3600000 (One hour)|
Example
For Express 4.xx
const express = require('express');
const session = require('express-session');
const Store = require('express-sqlite3')(session);
const app = express();
const storeOptions = {
db: ':memory:', // Use SQLite3 in memory db.
concurentDb: true, // Enable SQLite3 WAL.
};
app.use(session({
store: new Store(storeOptions),
secret: 'qwerty',
resave: false,
saveUninitialized: true,
}));
Test
Install dev dependencies.
npm i -D express-sqlite3
Then run
npm test
or npm run test:coverage