var app = require('http').createServer(handler), fs = require('fs'); app.listen(80); function handler (req, res) { fs.readFile(__dirname + req['url'], function (err, data) { if (err) { res.writeHead(500); return res.end('

Error loading ' + __dirname + req['url'] + '

'); } res.writeHead(200); res.end(data); }); }