@voidpkg/fastify-mongo-store
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

@voidpkg/fastify-mongo-store

node version License: MIT

Introduction

A MongoDB 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 MongoDB database instead.

Installation

npm i --save @voidpkg/fastify-mongo-store
# or
yarn add @voidpkg/fastify-mongo-store

Usage

Use with @fastify/session's store property.

import { Store } from "@voidpkg/fastify-mongo-store";
import fastify from "fastify";

const app = fastify();

app.register(require("@fastify/cookie"));
app.register(require("@fastify/session"), {
    secret: "a secret with minimum length of 32 characters",
    store: new Store({
        collection: "sessions",
        url: "mongodb://127.0.0.1:27017",
        database: "fastify-mongodb-store"
    })
});


© 2019 — 2023 Void Development, Ltd. All rights reserved.

Readme

Keywords

none

Package Sidebar

Install

npm i @voidpkg/fastify-mongo-store

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

4.91 kB

Total Files

6

Last publish

Collaborators

  • clqu