Socket
Socket
Sign inDemoInstall

express-session-sqlite

Package Overview
Dependencies
4
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    express-session-sqlite

SQLite-backed session store for express-session written in Typescript


Version published
Weekly downloads
172
decreased by-41.1%
Maintainers
2
Install size
189 kB
Created
Weekly downloads
 

Changelog

Source

2.1.1 - Fri May 27 2022 11:43:11

Contributor: [Theo Gravity](https://github.com/Theo Gravity)

  • Update dependencies, remove deprecated inherits (#16)

This is a slight optimization update.

Readme

Source

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

Keywords

FAQs

Last updated on 27 May 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc