Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

node.js session

node.js session

Problem

I have a page - index.html and chat.html.

On page index.html - I have a form and inputs (input1 and input2) and the button.

When I press the button I want to save the entries using node.js. When I go to the page chat.html, I want to retrieve these values​​.

When i do refresh the page so I do not want to lose data.

Thank you for your help!

Problem courtesy of: Jenan

Solution

Node can "remember" the data on the server side, but you would probably want to use Express.js with its session store (backed by MongoDB or Redis) to keep that data even after the process restarts (unless there's no problem in loosing it).

Read more about Express on the official website and checkout these examples also: https://github.com/visionmedia/express/tree/master/examples

Other resources:

How to store session values with Node.js and mongodb?
nodeJS - How to create and read session with express

Solution courtesy of: alessioalex

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

node.js session

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×