try this instead: server.use(function(req, res, next) { res.redirect = function(addr) { res.header('Location', addr); res.send(302); } done(); });
Note you're adding the redirect function to each response object, inside a middleware function, so you need to let the middleware keep going.
try this instead:
server.use(function(req, res, next) {
res.redirect = function(addr) {
res.header('Location', addr);
res.send(302);
}
done();
});
Note you're adding the redirect function to each response object, inside a middleware function, so you need to let the middleware keep going.