1.0.0 • Published 3 years ago
@bttger/better-sqlite3-session-store v1.0.0
better-sqlite3-session-store
better-sqlite3-sessions-store provides a better-sqlite3 session storage for express-session.
Install
$ npm i --save better-sqlite3-session-storeUsage
const sqlite = require("better-sqlite3");
const session = require("express-session")
const SqliteStore = require("better-sqlite3-session-store")(session)
const db = new sqlite("sessions.db", { verbose: console.log });
app.use(
  session({
    store: new SqliteStore({
      client: db, 
      expired: {
        clear: true,
        intervalMs: 900000 //ms = 15min
      }
    }),
    secret: "keyboard cat",
    resave: false,
  })
)License
See License.
Changelog
0.1.0
- Use correct temporal unit for express's 
cookie.maxAge(it's milliseconds) - Make calling 
cbfunction parameter safe- (breaking) Remove TypeScript support
 
 
0.0.3
- Add TypeScript support
 - Add (optional) 
allmethod 
0.0.2
- Bug fix: For almost all Store methods, when an error was caught, their
execution wasn't stopped with e.g. a 
returnstatement 
0.0.1
- Release initial version
 
Inspiration
To build this library, I looked at other session stores:
1.0.0
3 years ago