turned the redirect thing into a loadable host_redirect middleware

This commit is contained in:
2011-12-25 09:51:42 +00:00
parent 533cf0822b
commit 349e9eaef6
4 changed files with 30 additions and 14 deletions

View File

@@ -0,0 +1,7 @@
module.exports = (redirect_map = {}) ->
(req, res, next) ->
host = req.header('Host')
if redirect_map[host]
res.redirect(redirect_map[host])
else
next()