koa-redirects
v1.1.0
Published
redirect with prefix for koa
Downloads
6
Readme
koa-redirects
- redirect with
prefix
map
support
Example
const redirects = require('koa-redirects')
const koa = require('koa')
const app = koa()
redirects(app, {
prefix: '/api/v2',
map: {
'auth': 'http://some.com/api/oauth'
}
})
// or
// redirects(app, '/api/v2')
app.use(function*() {
this.redirects('/bar')
})
app.use(function*() {
this.redirects('auth')
})
License
MIT