import glob from 'glob'
import Router from 'koa-router'
import convert from 'koa-convert'

exports = module.exports = function initModules(app) {
  glob(`${__dirname}/*`, { ignore: '**/index.js' }, (err, matches) => {
    if (err) { throw err }

    matches.forEach((mod) => {
      const routerConfig = require(`${mod}/router`).default
      const router = new Router({ prefix: routerConfig.base })

      for (const [key, props] of Object.entries(routerConfig)) {
        if (key === 'base') { continue }

        const {
          method = '',
          route = '',
          middleware = [],
          controller
        } = props

        router[method.toLowerCase()](route, ...middleware, controller)

        app
          .use(router.routes())
          .use(router.allowedMethods())
      }
    })
  })
}

@@ -52,42 +52,8 @@
 ter'
-%0Aimport convert from 'koa-convert'
 %0A%0Aex
@@ -542,45 +542,21 @@
     
-middleware = %5B%5D,%0A          controller
+handlers = %5B%5D
 %0A   
@@ -622,30 +622,16 @@
  ...
-middleware, control
+hand
 ler
+s
 )%0A%0A 

Update router generation with `handlers`