route-mirror
v0.1.2
Published
Auto generate redirects for similar urls in express.
Downloads
5
Readme
route-mirror
Auto generate redirects for similar urls in express.
Install
$ npm install --save route-mirror
Usage
var routeMirror = require('route-mirror')
var app = express()
// create a mirror that can be used to set up redirects for non-slugified urls.
var mirror = routeMirror(app, function(url) {
return url.replace(/-/g, '')
})
// this will set up two routes:
// '/this-is-a-test'
// '/thisisatest' which will redirect to '/this-is-a-test'
mirror.get('/this-is-a-test', function(req, res) {
res.render('test')
})
License
ISC © Raine Lourie