Skip to content

RomanBurunkov/express-sqlite3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

express-sqlite3

npm codecov

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

About

SQLite3 session store for express-session

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published