Referencing external files with a node.js server?
I have an Ubuntu 10.04 hosting server which allows me to run [node.js][1] off of it.  I'm making an test homepage and I have a few files as follows:

`index.html`:

    <!DOCTYPE html>
    
    <html lang="en">
    <head>
    	<meta charset="utf-8">
    	<title>iSuperMario</title>
    	
    	<link rel="stylesheet" href="css/reset.css">
    	<link rel="stylesheet" href="css/style.css">
    	
    	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
    	<script src="/nowjs/now.js"></script>
    	<script src="js/chat.js"></script>
    </head>
    <body>
    	<div id="wrapper">
    		<div id="header">
    			<img src="images/green_pipe_960.png">
    			<img src="images/orange_pipe_960.png">
    		</div>
    		<div id="chat">
    			<input type="text" id="text-input">
    			<input type="button" value="Send" id="send-button">
    		</div>
    		<div id="content">
    		</div>
    		<div id="rooms">
    		</div>
    	</div>
    </body>
    </html>

`reset.css` and `style.css` (which both just contain styling for the `index.html` page

`chat.js` (which contains some scripting to implement the barebones chat function for the `index.html` page)

`server.js` which is a `node.js` server utilizing [nowjs][2] to serve the `index.html` page on port `8080` of the Ubuntu server and to implement the chat function:

    var fs = require('fs');
    var server = require('http').createServer(function(req, response){
      fs.readFile(__dirname+'/index.html', function(err, data){
        response.writeHead(200, {'Content-Type':'text/html'});
        response.write(data);
        response.end();
      });
    });
    server.listen(8080);
    var everyone = require("now").initialize(server);
    
    
    everyone.connected(function(){
      console.log("Someone has joined!");
    });
    
    
    everyone.disconnected(function(){
      console.log("Someone has left...");
    });
    
    everyone.now.distributeMessage = function(message){everyone.now.receiveMessage(message);};

So, when I view the page from the server in a browser, none of the external resources (`reset.css`, `style.css`, `chat.js`, `green_pipe_960.png` and `orange_pipe_960.png`) are connected properly.

How should I enable these?  I mean, if I had to, and it simplified the process a great deal, I could always include the external styles and scripts in `index.html`.  But, the images could never be embedded (at least I think xD).


Thanks!

  [1]: http://nodejs.org
  [2]: http://nowjs.com/
Referencing external files with a node.js server?
===

I have an Ubuntu 10.04 hosting server which allows me to run [node.js][1] off of it.  I'm making an test homepage and I have a few files as follows:

`index.html`:

    <!DOCTYPE html>
    
    <html lang="en">
    <head>
    	<meta charset="utf-8">
    	<title>iSuperMario</title>
    	
    	<link rel="stylesheet" href="css/reset.css">
    	<link rel="stylesheet" href="css/style.css">
    	
    	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
    	<script src="/nowjs/now.js"></script>
    	<script src="js/chat.js"></script>
    </head>
    <body>
    	<div id="wrapper">
    		<div id="header">
    			<img src="images/green_pipe_960.png">
    			<img src="images/orange_pipe_960.png">
    		</div>
    		<div id="chat">
    			<input type="text" id="text-input">
    			<input type="button" value="Send" id="send-button">
    		</div>
    		<div id="content">
    		</div>
    		<div id="rooms">
    		</div>
    	</div>
    </body>
    </html>

`reset.css` and `style.css` (which both just contain styling for the `index.html` page

`chat.js` (which contains some scripting to implement the barebones chat function for the `index.html` page)

`server.js` which is a `node.js` server utilizing [nowjs][2] to serve the `index.html` page on port `8080` of the Ubuntu server and to implement the chat function:

    var fs = require('fs');
    var server = require('http').createServer(function(req, response){
      fs.readFile(__dirname+'/index.html', function(err, data){
        response.writeHead(200, {'Content-Type':'text/html'});
        response.write(data);
        response.end();
      });
    });
    server.listen(8080);
    var everyone = require("now").initialize(server);
    
    
    everyone.connected(function(){
      console.log("Someone has joined!");
    });
    
    
    everyone.disconnected(function(){
      console.log("Someone has left...");
    });
    
    everyone.now.distributeMessage = function(message){everyone.now.receiveMessage(message);};

So, when I view the page from the server in a browser, none of the external resources (`reset.css`, `style.css`, `chat.js`, `green_pipe_960.png` and `orange_pipe_960.png`) are connected properly.

How should I enable these?  I mean, if I had to, and it simplified the process a great deal, I could always include the external styles and scripts in `index.html`.  But, the images could never be embedded (at least I think xD).


Thanks!

  [1]: http://nodejs.org
  [2]: http://nowjs.com/