title: node.js and HTML page? How to combine?
body: <p>I would like to establish a communication between a HTML-page with some JavaScript code and a simple webserver based on node.js.
  My first node program (demo) looks like this and i see it working by calling http:…name=someName from the web browser! Fantastic!</p>
  
  <pre><code>http = require('http');
  var url = require('url');
  var htmlencode = require('htmlencode');
  var port = process.env.PORT || 3000;
  
  var request = function(req, res) {
  res.writeHead(200, {'Content-Type': 'text/html'});
  var parsed_url = url.parse(req.url, true)
  res.write("");
  res.write("&lt;h1&gt;Hello World&lt;/h1&gt;");
  res.write("&lt;h2&gt;Hello " + htmlencode.htmlEncode(parsed_url.query.name)+"&lt;/h2&gt;");
  res.write("");
  res.end();
  };
  
  var server = http.createServer(request);
  server.listen(port, function() {
  console.log("Call server with http://localhost:" + port +"?name=");
  });
  </code></pre>
  
  <p>Now i have my HTTP-page and i would like to start with that and then let node handle the requests.
  I assume, i have to load it from node, but how?
  Or do i simply load it by calling the page and then switch to node, but how again?
  I guess communication from my page is done by AJAX?</p>
  
  <p>Thanks for any help and i would appreciate some sample code!
  Peter</p>