0.2.2 • Published 3 years ago

xp-session-store v0.2.2

Weekly downloads
46
License
MIT
Repository
github
Last release
3 years ago

xp-session-store



Installation

$ npm install xp-session-store

Dependencies

npm.io

Example

const mongoose = require("mongoose");
const app = require("express")();
const session = require("express-session");
const xpSessionStore = require("xp-session-store");

mongoose.connect("MONGODB_URI", {
  useNewUrlParser: true,
  useUnifiedTopology: true,
  useFindAndModify: false,
  useCreateIndex: true,
});

app.use(
  session({
    secret: "shhh! it's a secret",
    store: new xpSessionStore({
      /* All options are optional */
      collection: "sessions",
      dbname: "myotherdb",
      /* How to use expires option:
      https://date-fns.org/docs/add */
      expires: { days: 7 },
    }),
    /* About resave and saveUninitialized:
    https://stackoverflow.com/a/40396102/15275415 */
    resave: false,
    saveUninitialized: false,
  })
);

app.listen(3000)

That's it!

npm.io


npm.io npm.io npm.io npm.io

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago