tags:

views:

182

answers:

2

What is the best way to manage session variables in nodejs? is there a lib?

+1  A: 

nodejs provides a basic http API. http is stateless, and ideas of sessions and session variables exist in framework/protocols build on top of http. http://en.wikipedia.org/wiki/Session_%28computer_science%29

Take a look at http://geddyjs.org/ or http://expressjs.com/ as examples of web frameworks built with node that provide sessions.

z5h
Thansk, will look into express.
Timmy
+6  A: 

You can do that very easily using:

Other option is to use frameworks:

  • Express.js: http://expressjs.com/

    It seems to be the most used node.js framework. Is like Sinatra for Ruby and runs on top of connect.

  • Geddy: http://geddyjs.org/

    If you want to do more complex WebApps, Geddy is the one you choose. Is like Rails for Ruby.

donald