0.1.2 • Published 10 years ago

route-mirror v0.1.2

Weekly downloads
2
License
ISC
Repository
github
Last release
10 years ago

route-mirror

Build Status NPM version

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