SQLite3 session store for the express-session package.
npm i express-sqlite3
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) |
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,
}));
Install dev dependencies.
npm i -D express-sqlite3
Then run
npm test
or npm run test:coverage