lib/index.js
function load (routes) {
  if (!Array.isArray(routes) || routes.length === 0) {
    throw new Error('argument should be an array not empty.')
  }

  if (!Array.isArray(routes[0])) {
    routes = [routes]
  }

  return routes.map(route => _getFiles(route))
               .reduce((acc, routes) => acc.concat(routes), [])
}
function load (routes) {
  if (!Array.isArray(routes) || routes.length === 0) {
    throw new Error('argument should be an array not empty.')
  }

  if (!Array.isArray(routes[0])) {
    routes = [routes]
  }

  return routes.map(route => _getFiles(route))
               .reduce((acc, routes) => acc.concat(routes), [])
}
function load ( routes ) { if ( ! Array . isArray ( routes ) || routes . length === 0 ) { throw new Error ( 'argument should be an array not empty.' ) } if ( ! Array . isArray ( routes [ 0 ] ) ) { routes = [ routes ] } return routes . map ( route => _getFiles ( route ) ) . reduce ( ( acc , routes ) => acc . concat ( routes ) , [ ] ) }
entry point to be called when wanted to load dynamically
your routes.
return all imported routes.

arg
---
you want to explore the whole directory tree applying
the same prefix to every routes
[
path.join(__dirname, 'src', 'routes'),
'api',
'v1'
]

you want to explore multiple directories applying
different prefix to everyone
[
[
path.join(__dirname, 'src', 'users'),
'api',
'v1',
'users'
],
[
path.join(__dirname, 'src', 'routes', 'events'),
'api',
'events'
]
]

first array entry = directory you wnat to explore
second...n = prefix you want to apply to te final endpoint

@param  {Array.<String...>|Array.<Array>} routes  directories you want to
explore with extra configuration
@return {Array.<Object>}   imported routes
entry point to be called when wanted to load dynamically your routes . return all imported routes .