mirror of
https://github.com/jimeh/heartb.it.git
synced 2026-02-19 04:46:40 +00:00
moved www.heartb.it redirection middleware to production environment
This commit is contained in:
18
app.js
18
app.js
@@ -9,14 +9,6 @@
|
||||
app.set('views', __dirname + '/views');
|
||||
app.set('view engine', 'coffee');
|
||||
app.register('.coffee', require('coffeekup').adapters.express);
|
||||
app.use(function(req, res, next) {
|
||||
console.log("Hostname: %s", req.header('Host'));
|
||||
if (req.header('Host') === 'www.heartb.it') {
|
||||
return res.redirect('http://heartb.it/');
|
||||
} else {
|
||||
return next();
|
||||
}
|
||||
});
|
||||
app.use(express.bodyParser());
|
||||
app.use(express.methodOverride());
|
||||
return app.use(express.static(__dirname + '/public'));
|
||||
@@ -30,7 +22,15 @@
|
||||
});
|
||||
|
||||
app.configure('production', function() {
|
||||
return app.use(express.errorHandler);
|
||||
app.use(express.errorHandler);
|
||||
return app.use(function(req, res, next) {
|
||||
console.log("Hostname: %s", req.header('Host'));
|
||||
if (req.header('Host') === 'www.heartb.it') {
|
||||
return res.redirect('http://heartb.it/');
|
||||
} else {
|
||||
return next();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/', function(req, res) {
|
||||
|
||||
@@ -8,12 +8,6 @@ app.configure ->
|
||||
app.set 'views', __dirname + '/views'
|
||||
app.set 'view engine', 'coffee'
|
||||
app.register '.coffee', require('coffeekup').adapters.express
|
||||
app.use (req, res, next) ->
|
||||
console.log "Hostname: %s", req.header('Host')
|
||||
if req.header('Host') == 'www.heartb.it'
|
||||
res.redirect('http://heartb.it/')
|
||||
else
|
||||
next()
|
||||
app.use express.bodyParser()
|
||||
app.use express.methodOverride()
|
||||
app.use express.static(__dirname + '/public')
|
||||
@@ -23,6 +17,12 @@ app.configure 'development', ->
|
||||
|
||||
app.configure 'production', ->
|
||||
app.use express.errorHandler
|
||||
app.use (req, res, next) ->
|
||||
console.log "Hostname: %s", req.header('Host')
|
||||
if req.header('Host') == 'www.heartb.it'
|
||||
res.redirect('http://heartb.it/')
|
||||
else
|
||||
next()
|
||||
|
||||
|
||||
# Routes
|
||||
|
||||
Reference in New Issue
Block a user