Skip to content

Instantly share code, notes, and snippets.

Created August 10, 2012 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/b63251407a393f06ebe3 to your computer and use it in GitHub Desktop.
Save anonymous/b63251407a393f06ebe3 to your computer and use it in GitHub Desktop.
var app = require('http').createServer(handler)
, io = require('socket.io').listen(app)
, fs = require('fs')
app.listen(80);
function handler (req, res) {
fs.readFile(__dirname + '/index.html',
function (err, data) {
if (err) {
res.writeHead(500);
return res.end('Error loading index.html');
}
res.writeHead(200);
res.end(data);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment