title: node.js - stuck on making simple web chat
body: <p><br />
  It may sound strange, But I'm trying to make very simple web chat, and I need help..<br/></p>
  
  <p>I made this far with node -</p>
  
  <pre><code>var http = require('http');
  var fs = require('fs');
  var path = require('path');
  
  var messages = [];
  
  // Simple Function to load HTML/JavaScript/CSS Files
  function LoadHTML(html, requrl, res) {
      var filePath = '.' + requrl;
      if (filePath == './') {
          filePath = './' + html;
      }
  
      var extname = path.extname(filePath);
      var contentType = 'text/html';
      switch (extname) {
          case '.js':
              contentType = 'text/javascript';
          break;
          case '.css':
              contentType = 'text/css';
          break;
      }
  
      fs.exists(filePath, function(exists) {
  
          if (exists) {
              fs.readFile(filePath, function(error, content) {
                  if (error) {
                      res.writeHead(500);
                      res.end();
                  }
                  else {
                      res.writeHead(200, { 'Content-Type': contentType });
                      res.end(content, 'utf-8');
                  }
              });
          }
          else {
              res.writeHead(404);
              res.end();
          }
      });  
  }
  
  http.createServer(function (req, res) {
      LoadHTML('index.html', req.url, res);
  }).listen(8125);
  </code></pre>
  
  <p><br />
  The HTML/CSS I'm using - <a href="http://jsfiddle.net/yZ5at/" rel="nofollow">http://jsfiddle.net/yZ5at/</a></p>
  
  <p><br />
  From here I'm stuck.. I want that when the user type something into the textarea and hit enter he's text will be shown in the chat div.</p>
  
  <p>But how can I do that? any help please?</p>