Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mrdcvlsc/fastify-session-better-sqlite3-store
A simple session store for fastify-session using better-sqlite3
https://github.com/mrdcvlsc/fastify-session-better-sqlite3-store
better-sqlite better-sqlite3 cookies encrypted encrypted-session javascript javascript-framework javascript-library library npm npm-module npm-package session session-cookie session-management session-storage session-store user-sessions
Last synced: about 1 month ago
JSON representation
A simple session store for fastify-session using better-sqlite3
- Host: GitHub
- URL: https://github.com/mrdcvlsc/fastify-session-better-sqlite3-store
- Owner: mrdcvlsc
- License: mit
- Created: 2022-07-19T06:44:05.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-23T12:00:52.000Z (about 1 year ago)
- Last Synced: 2024-05-06T12:23:20.583Z (6 months ago)
- Topics: better-sqlite, better-sqlite3, cookies, encrypted, encrypted-session, javascript, javascript-framework, javascript-library, library, npm, npm-module, npm-package, session, session-cookie, session-management, session-storage, session-store, user-sessions
- Language: JavaScript
- Homepage:
- Size: 230 KB
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fastify-session-better-sqlite3-store
https://www.npmjs.com/package/fastify-session-better-sqlite3-store
![ci](https://github.com/mrdcvlsc/fastify-session-better-sqlite3-store/actions/workflows/ci.yml/badge.svg)
![standard](https://github.com/mrdcvlsc/fastify-session-better-sqlite3-store/actions/workflows/standard.yml/badge.svg)
![node version](https://img.shields.io/badge/node%20-%3E=%2014.x-brightgreen.svg)
[![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)A [better-sqlite3](https://github.com/WiseLibs/better-sqlite3) session store for [@fastify/session](https://github.com/fastify/session). By default [@fastify/session](https://github.com/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.
```js
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](https://github.com/mrdcvlsc/fastify-session-better-sqlite3-store/blob/main/LICENSE)