Redirecting a GET request to another website using Express.js
I wanted to set up some pages on my website that redirect to my social network profiles. Since my website is currently running on node.js + express, I was able to use the redirect method that comes with express.js.
var express = require('express'),
server = express();
server.get('/github/', function (req, res) {
res.redirect(301, 'https://github.com/codybonney');
});
The 301 response code lets search engines know that it is a permanent redirect.
Now, when I visit http://codybonney.com/github it will redirect to https://github.com/codybonney