Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kenmickles committed Sep 14, 2012
1 parent 34eda60 commit 73831a8
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: node web.js
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
heroku-redirect
===============
Simple node app to redirect all requests from a Heroku app to a new URL. I've needed this more times than I should have.

## Configuration
```
heroku config:add NEW_BASE_URL=http://example.com
```
11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "node-example",
"version": "0.0.1",
"dependencies": {
"express": "2.5.x"
},
"engines": {
"node": "0.8.x",
"npm": "1.1.x"
}
}
12 changes: 12 additions & 0 deletions web.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
var express = require('express');

var app = express.createServer(express.logger());

app.get('*', function(request, response) {
response.redirect(process.env.NEW_BASE_URL + request.url)
});

var port = process.env.PORT || 5000;
app.listen(port, function() {
console.log("Listening on " + port);
});

0 comments on commit 73831a8

Please sign in to comment.