2

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 refresh the page, I do not want to lose data.

halfer
  • 19,824
  • 17
  • 99
  • 186
Jenan
  • 3,408
  • 13
  • 62
  • 105
  • 1
    Node "keeps" all variables by itself, it's a long-running process. What is it that you're asking? Please clarify – Kos Dec 23 '11 at 19:24
  • Sorry for my english. Can I store data into the session in node.js? – Jenan Dec 23 '11 at 19:29
  • 1
    It is important to have this distinction between client- and server-side data; Node can actually store stuff on the server side even without a database backend. – Kos Dec 23 '11 at 19:58

1 Answers1

1

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

Community
  • 1
  • 1
alessioalex
  • 62,577
  • 16
  • 155
  • 122