1var fs = require('fs'),
2 http = require('http');
3
4http.createServer(function (req, res) {
5 fs.readFile(__dirname + req.url, function (err,data) {
6 if (err) {
7 res.writeHead(404);
8 res.end(JSON.stringify(err));
9 return;
10 }
11 res.writeHead(200);
12 res.end(data);
13 });
14}).listen(8080);