I want to run a very simple HTTP server. Every GET request to example.com should get index.html served to it but as a regular HTML page (i.e., same
Node.js sample app Node Chat has the functionality you want.
In it's README.textfile
3. Step is what you are looking for.
step1
- create a server that responds with hello world on port 8002
step2
- create an index.html and serve it
step3
- introduce util.js
- change the logic so that any static file is served
- show 404 in case no file is found
step4
- add jquery-1.4.2.js
- add client.js
- change index.html to prompt user for nickname
Here is the server.js
Here is the util.js