var http = require('http'), url = require('url'), fs = require('fs'); http.createServer(function (req, res) { var urlParts = url.parse(req.url); switch(urlParts.pathname) { case "/": welcome(req, res); break; default: notfound(req,res); break; } }).listen(80); function welcome(req, res) { fs.readFile('/usr/share/ovh/index.html', function (err, html) { if (err) { throw err; } res.writeHeader(200, {"Content-Type": "text/html"}); res.write(html); res.end(); }); } function notfound(req, res) { res.writeHeader(302, {"Location": "/"}); res.end(); }