0.0.1 • Published 8 years ago
@aleph/express-json-redirects v0.0.1
express-json-redirects

Middleware that allows you to use JSON to specify redirects in Express
Installation
$ npm install --save @aleph/express-json-redirectsUsage
Your redirects must be a JSON file with an array of objects. The properties of the objects are:
route(Required string) - An Express route, like/someroutetarget(Required string) - The route to redirect to, like/target/routestatus(Optional integer) - The redirect code you want to return, default302method(Optional string) - Express method, defaultallqsa(Optional boolean) - Whether or not to pass along query strings, defaultfalse
This package extends the express object directly, so you must do a few things
to get it to work. The basic usage alongside Express:
const jsonRedirects = require('express-json-redirects');
const redirects = require('./redirects.json');
const app = express();
jsonRedirects(app);
app.expressJsonRedirects(redirects);License
MPL-2.0 © Matt Glaser
0.0.1
8 years ago