How to create session with Node Js?

I am new to Node Js. I am creating app with socket.io and express, which fetches tweets after user login. How can I create session so that tweets page should open only after login and not without login.

var express = require('express')
  , app = express()
  , http = require('http')
  , server = http.createServer(app)
  , Twit = require('twit')
  , io = require('socket.io').listen(server);

app.get('/', function (req, res) {
  res.sendfile(__dirname + '/login.html');
});

app.get('/tweets', function (req, res) {
  res.sendfile(__dirname + '/twitter.html');
});

Configuring Express

var app = express();

    app.configure(function () {
        app.use(express.cookieParser());
        app.use(express.session({secret: 'secret', key: 'express.sid'}));
    });


    app.get('/', function (req, res) {
        res.sendfile(__dirname + '/index.html');
    });

    server = http.createServer(app)
    server.listen(3000);

Configuring Socket.IO

io = io.listen(server);

io.set('authorization', function (handshakeData, accept) {

  if (handshakeData.headers.cookie) {

    handshakeData.cookie = cookie.parse(handshakeData.headers.cookie);

    handshakeData.sessionID = connect.utils.parseSignedCookie(handshakeData.cookie['express.sid'], 'secret');

    if (handshakeData.cookie['express.sid'] == handshakeData.sessionID) {
      return accept('Cookie is invalid.', false);
    }

  } else {
    return accept('No cookie transmitted.', false);
  } 

  accept(null, true);
});

Reference

If you use Expressjs, look at the example from Expressjs repository, or read the article about cookie-based & store-based sessions.