sessionstore
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -7,2 +7,3 @@ 'use strict'; | ||
async = require('async'), | ||
jsondate = require('jsondate'), | ||
elasticsearch = require('elasticsearch'); | ||
@@ -149,5 +150,8 @@ | ||
if (typeof res == 'undefined') return callback(null, null); | ||
if (res._source && res._source.expiresAt && (new Date(res._source.expiresAt)).getTime() > Date.now()) { | ||
delete res._source.expiresAt; | ||
return callback(null, res._source); | ||
if (res._source) { | ||
var sess = jsondate.parse(JSON.stringify(res._source)); | ||
if (sess.expiresAt && sess.expiresAt.getTime() > Date.now()) { | ||
delete sess.expiresAt; | ||
return callback(null, sess); | ||
} | ||
} | ||
@@ -154,0 +158,0 @@ callback(null, null); |
{ | ||
"author": "adrai", | ||
"name": "sessionstore", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"private": false, | ||
@@ -6,0 +6,0 @@ "main": "index.js", |
@@ -113,2 +113,21 @@ # Introduction | ||
## Connecting to elasticsearch | ||
var sessionstore = require('sessionstore'); | ||
var express = require('express'); | ||
var app = express(); | ||
app.use(express.session({ | ||
store: sessionstore.createSessionStore({ | ||
type: 'elasticsearch', | ||
host: 'localhost:9200', // optional | ||
prefix: '', // optional | ||
index: 'express', // optional | ||
typeName: 'session', // optional | ||
pingInterval: 1000, // optional | ||
timeout: 10000 // optional | ||
}) | ||
})); | ||
## Catch connect ad disconnect events | ||
@@ -115,0 +134,0 @@ |
@@ -1,2 +0,2 @@ | ||
#### v1.2.1 | ||
#### v1.2.2 | ||
- added elasticsearch support | ||
@@ -3,0 +3,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38783
961
187