Last active
September 29, 2016 17:35
-
-
Save FelipeJz/289a76ed6c4844767420e73d5d504d1d to your computer and use it in GitHub Desktop.
Nodejs, Express simple redirect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express') | |
var app = express(); | |
app.set('port', (process.env.PORT || 8080)) | |
app.get('*', function(request, response) { | |
response.redirect('http://example.com') | |
}) | |
app.listen(app.get('port'), function() { | |
console.log("Node app is running at localhost:" + app.get('port')) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment