koajs / joi-router

Configurable, input and output validated routing for koa
MIT License
450 stars 96 forks source link

add support to accepts an array of route objects #7

Closed martinmicunda closed 8 years ago

martinmicunda commented 8 years ago

I like to define array of routes in my application same like in hapi so I have added option to pass array to route() function. route() accepts an object or array of objects now.

var router = require('koa-joi-router');
var public = router();

var routes = [
  {
    method: 'post',
    path: '/users',
    handler: function*(){}
  },
  {
    method: 'get',
    path: '/users',
    handler: function*(){}
  }
];

public.route(routes);
aheckmann commented 8 years ago

Thanks!