Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
junosuarez committed Mar 13, 2013
1 parent 91172a6 commit 4cc8102
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions index.js
Expand Up @@ -11,10 +11,10 @@ try {
var DAYS_MS = 24*60*60*1000
var defaultOpts = {
sessionDuration: 30 * DAYS_MS,
db: 'mongodb://localhost:27017/',
connectionString: 'mongodb://localhost:27017/',
collection: 'snapSessions',
store: (!store || !mongo) ? false : function (cb) {
mongo.connect(this.db, function (err, db) {
mongo.connect(this.connectionString, function (err, db) {
if (err) return cb(err)
try {
store = new store({db: db})
Expand All @@ -33,10 +33,13 @@ module.exports = function snap(pipeline, params, cb) {
if (typeof params !== 'object') throw new Error('Missing required parameter: params must be an object')
if (!params.secret) throw new Error('Missing required parameter: secret')
withDefaults(params)
console.log(params)
if (!params.store || !params.connectionString) throw new Error('Session Store not available. Provide your own with the `store` parameter or run `$ npm install`.')

bounce.call(params, params.store, function (err, store) {
if (err) cb ? cb(err) : throw err;
if (err) {
if (cb) { cb(err) } else { throw err }
}

pipeline.use(muddle(
connect.cookieParser(),
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "snap",
"version": "0.2.0",
"version": "0.2.1",
"description": "session middleware for the truly lazy using mongodb",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 4cc8102

Please sign in to comment.