NODEJS set session nodejs - Net-Raft.com

Welcome aboard! We are happy you are here and wish you good net-raft!




Just a Web Code Solution
join us

set session nodejs


 900

NODEJS


3

// at first you must install npm install node-session

var http = require('http');
var NodeSession = require('node-session');

http.createServer(function (req, res) {

callback = function () {

};

session = new NodeSession({secret: 'Q3UBzdH9GEfiRCTKbi5MTPyChpzXLsTD'});
session.startSession(req, res, callback); // start the Session
req.session.put('mysession', 'Hello'); // set the Session
var value = req.session.get('mysession'); // get the Session

if (value) {
res.write("<p>your session's value is: <b>" + value + "</b></p>");
} else {
res.write('<p>Session is not set!</p>');
}

res.end();
}).listen(3000);

console.log("Listening to Port 3000");

// Removing An Item From The Session

req.session.forget('mysession');

//Removing All Items From The Session

req.session.flush();


By        
The power of the user (%)
18%

NODEJS


1

// at first you install npm install node-session


By        
The power of the user (%)
18%



The most helpful NODEJS solutions

get user ipget user ipNODEJS

Click to see more ...

  7.6K     1.7K

how to get client netmask using node.js ?how to get client netmask using node.js ?NODEJS

Click to see more ...

  4.2K     557

How to get client machine name and computer name with node.js?How to get client machine name and computer name with node.js?NODEJS

Click to see more ...

  12.1K     440

how to get client local ip address using node.js ?how to get client local ip address using node.js ?NODEJS

Click to see more ...

  2.3K     311

How to get client ip address using node.jsHow to get client ip address using node.jsNODEJS

Click to see more ...

  2.1K     271

How to combine node.js and jquery ?How to combine node.js and jquery ?NODEJS

Click to see more ...

  1.5K     247

how to detect tablet, iPad, iPhone, Android and Blackberry using nodejs ?how to detect tablet, iPad, iPhone, Android and Blackberry using nodejs ?NODEJS

Click to see more ...

  1.8K     161

get client region using node.js ?get client region using node.js ?NODEJS

Click to see more ...

  1.4K     128

get real user ip address using node.js?get real user ip address using node.js?NODEJS

Click to see more ...

  1K     124

get server ip address from hostname nodejsget server ip address from hostname nodejsNODEJS

Click to see more ...

  2.9K     122

Welcome aboard!
We are happy you are here and
wish you good net-raft!