connect-dynamodb is a DynamoDB session store backed by dynode
$ npm install connect-dynamodb
client
An existing dynode client object you normally get fromnew (dynode.Client)({accessKeyId: "AWSAccessKey", secretAccessKey: "SecretAccessKey"});
table
DynamoDB server session table nameaccessKeyId
AWS accessKeyIdsecretAccessKey
AWS secretAccessKeyprefix
Key prefix defaulting to "sess"reapInterval
How often expired sessions should be cleaned up
var connect = require('connect')
, DynamoDBStore = require('connect-dynamodb')(connect);
var store = new DynamoDBStore({
// Name of the table you would like to use for sessions.
table: 'myapp-sessions',
// AWSAccessKey
accessKeyId: 'AWSAccessKey',
// AWS secretAccessKey
secretAccessKey: 'SecretAccessKey',
// Optional. How often expired sessions should be cleaned up.
// Defaults to 600000 (10 minutes).
reapInterval: 600000
});
var server = connect.createServer();
server.use(connect.session({secret: 'YourSecretKey', store: store });
Or with express
var store = new DynamoDBStore({
// Name of the table you would like to use for sessions.
table: 'myapp-sessions',
// AWSAccessKey
accessKeyId: 'AWSAccessKey',
// AWS secretAccessKey
secretAccessKey: 'SecretAccessKey'
});
var app = express.createServer(
express.cookieParser()
, express.session({ secret: 'YourSecretKey', store: store)
);