Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
node module: session middleware for the truly lazy
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
LICENSE.md
README.md
index.js
package.json

README.md

snap

session middleware for the truly lazy

sets up all the connect-style middleware you need for session and user management.

use it with wham!

installation

$ npm install snap

example usage

with express:

var http = require('http')
var app = require('express')()
var snap = require('snap')
app.use(snap({secret: 'OH_SNAP'}))
app.use(function (req, res) {
  res.send('sessions!')
})
http.createServer(app).listen(1234)

with wham:

var wham = require('wham')('Example')
var snap = require('snap')
wham(snap({secret: 'OH_SNAP'}))
wham('log output', '/').get(function () {
  return 'sessions'!
})
wham.bam(1234)

parameters

snap takes a parameters object.

required

  • parameters.secret: a string used for seeding the session cookie

optional

  • parameters.store: a connect.session-compatible SessionStore. Defaults to connect-mongo

  • parameters.sessionDuration: number in milliseconds of inactivity that session cookie should persist. Defaults to 30 days.

  • parameters.cookie: A connect.session cookie object. Overrides parameters.sessionDuration.

license

MIT. (c) 2013 jden jason@denizac.org. See LICENSE.md

Something went wrong with that request. Please try again.