This module takes express routes and redirects them to external or internal URLs.
It is very similar to
redirects on NPM. In fact, I based my tests on the tests in
redirects. The difference between the two is my one doesn't rely on any other external libraries, so doesn't have as many features, hence the name 'simple'.
npm install express-simple-redirect --save
var redirect = ;// a bunch of express route definitionsapp;
Custom response code
You can also add a redirect HTTP status code. By default, this code is 307 (Temporary Redirect). You may wish to change it to 301 for a permanent redirection by doing:
Note: Response code 301 adds an entry to the client browser cache, meaning that the browser won't hit your server again. 301 is not recommended for routes that may change.
Loading from a file