fastify-session-better-sqlite3-store

2.1.1 • Public • Published

fastify-session-better-sqlite3-store

https://www.npmjs.com/package/fastify-session-better-sqlite3-store

ci standard node version License: MIT

A better-sqlite3 session store for @fastify/session. By default @fastify/session uses in-memory storage to store sessions. With this small package you can store sessions on an SQLite3 database instead.

Installation

npm install fastify-session-better-sqlite3-store

Example

Use with fastify-session's store property.

const fastify = require('fastify')({ logger: true })
const fastifyCookie = require('@fastify/cookie')
const fastifySession = require('@fastify/session')
const db = require('better-sqlite3')('./sqlite.db')

// require module
const SqliteStore = require('fastify-session-better-sqlite3-store')

fastify.register(fastifyCookie)
fastify.register(fastifySession, {
  store: new SqliteStore(db),
  // ...
  // other session options
  // ...
})

License

MIT Licence

Package Sidebar

Install

npm i fastify-session-better-sqlite3-store

Weekly Downloads

32

Version

2.1.1

License

MIT

Unpacked Size

13.6 kB

Total Files

9

Last publish

Collaborators

  • mrdcvlsc