Source Code: (back to article)
var http = require("http");
var url = require("url");

http.createServer(function(req, res) {
var pathname = url.parse(req.url).pathname;
res.writeHead(301,{Location: 'http://w3docs.com/' + pathname});
res.end();
}).listen(8888);