connect-deta
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

Connect Deta

Use Deta Base to store cookie sessions, compatiable with Express Session.

How to install:

npm install deta express express-session 
npm install connect-deta

How to use:

var express = require("express");
var session = require("express-session");
var DetaBaseStore = require("connect-deta")(session);

var app = express();

app.use(
  session({
    store: new DetaBaseStore({
      detaProjectKey: "", // your deta base project id
      detaBaseName: "session", // optional table name, defaults to "session"
      prefix: "test:", // optional prefix for session id
    }),
    secret: "keyboard cat",
    resave: false,
    saveUninitialized: true,
    cookie: {
      maxAge: 60 * 10000, // this will set the expiresAt field in Deta base
    },
  })
);

MIT Open Source

Dependents (0)

Package Sidebar

Install

npm i connect-deta

Weekly Downloads

1

Version

1.0.5

License

MIT

Unpacked Size

12.8 kB

Total Files

8

Last publish

Collaborators

  • ryker2000