1.1.0 • Published 9 years ago

koa-redirects v1.1.0

Weekly downloads
5
License
MIT
Repository
github
Last release
9 years ago

NPM version Build status Test coverage License Dependency status

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