- redirect with
prefix
map
support
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')
})
MIT