Socket
Book a DemoInstallSign in
Socket

ajn-session

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ajn-session

A very simple and lightweight session manager

Source
npmnpm
Version
0.0.4
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

A very simple and lightweight session manager

Configuration options:

Session.sessionLifeTime Number, default is 60000 * 30, which is 60 min

Session.maxSize Number, Max size of all data stored per session in bytes, default is 262144 bytes

Session.sessionName String, Name of the session cookie, default is 'nodesess';

usage:

var Session = require('../index').Session; var http = require('http');

var srv = http.createServer(function (req, res) { // initialize a session object on each request, pass the request and // response objects to it it will discover if session is alread set, and // create one if it isn't var session = new Session(req, res);

// set foo session property value to bar
session.setData('foo', 'bar');

// get foo session property value and print it to console
console.log(session.getData('foo'));

// delete foo session property value to bar
session.delData('foo', null);

// print 'foo' session property to console, it must return undefined
console.log(session.getData('foo'));
....

}); srv.listen(1111, '127.0.0.1');

FAQs

Package last updated on 27 May 2012

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