middleware/router/lib/router.js
function Router(opts) {
  if (!(this instanceof Router)) {
    return new Router(opts);
  }

  this.opts = opts || {};
  this.methods = this.opts.methods || [
    'HEAD',
    'OPTIONS',
    'GET',
    'PUT',
    'PATCH',
    'POST',
    'DELETE'
  ];

  this.params = {};
  this.stack = [];
  this.MATCHS = {};
}
function Router(opts) {
  if (!(this instanceof Router)) {
    return new Router(opts);
  }

  this.opts = opts || {};
  this.methods = this.opts.methods || [
    'HEAD',
    'OPTIONS',
    'GET',
    'PUT',
    'PATCH',
    'POST',
    'DELETE'
  ];

  this.params = {};
  this.stack = [];
  this.MATCHS = {};
}
function Router ( opts ) { if ( ! ( this instanceof Router ) ) { return new Router ( opts ) ; } this . opts = opts || { } ; this . methods = this . opts . methods || [ 'HEAD' , 'OPTIONS' , 'GET' , 'PUT' , 'PATCH' , 'POST' , 'DELETE' ] ; this . params = { } ; this . stack = [ ] ; this . MATCHS = { } ; }
Create a new router.

@example

Basic usage:

```javascript
var app = require('koa')();
var router = require('koa-router')();

router.get('/', function *(next) {...});

app
.use(router.routes())
.use(router.allowedMethods());
```

@alias module:koa-router
@param {Object=} opts
@param {String=} opts.prefix prefix router paths
@constructor
Create a new router .