Have ideas to improve npm?Join in the discussion! »

    route-mirror

    0.1.2 • Public • Published

    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

    Install

    npm i route-mirror

    DownloadsWeekly Downloads

    1

    Version

    0.1.2

    License

    ISC

    Last publish

    Collaborators

    • avatar