New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

koa-sess-mongo-store

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-sess-mongo-store

MongoDB store for koa-session middleware backed by node-mongodb-native.

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

koa-sess-mongo-store

MongoDB store for koa-session middleware backed by node-mongodb-native. Fork of connect-to-mongo store.

Installation

  npm install koa-sess koa-sess-mongo-store --save

Usage

Example

var koa = require('koa');
var session = require('koa-sess');
var MongoStore = require('koa-sess-mongo-store');

var app = koa();
app.keys = ['keys', 'keykeys'];
app.use(session({
  store: new MongoStore()
}));

app.use(function *() {
  switch (this.path) {
  case '/get':
    get.call(this);
    break;
  case '/remove':
    remove.call(this);
    break;
  }
});

function get() {
  var session = this.session;
  session.count = session.count || 0;
  session.count++;
  this.body = session.count;
}

function remove() {
  this.session = null;
  this.body = 0;
}

app.listen(8080);

Options

  • url mongodb connection url
  • db mongodb-native database object or database name (test by default)
  • collection collection name (sessions by default)
  • host db hostname (127.0.0.1 by default)
  • port db port (27017 by default)
  • ttl ttl in milliseconds (if set it overrides cookie maxAge)
  • user user for MongoDB
  • password password for MongoDB authentication
  • ssl use SSL to connect to MongoDB (false by default)

License

MIT

Keywords

FAQs

Package last updated on 12 Jun 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc