var redirect = require("redirecter")
var http = require("http")
http.createServer(function handleRequest(req, res) {
if (req.url === "/redir") {
redirect(req, res, "/foo")
} else if (req.url.match(/^\/status/)) {
var status = parseInt(req.url.substr(7), 10)
redirect(req, res, {
target: "/foo"
, statusCode: status
})
} else if (req.url === "/back") {
redirecter(req, res, "back")
} else {
res.end("foo")
}
}).listen(8080)