import { Router } from 'express' ; import glob from 'glob' ; export function registerRoutes ( router ) { const routes = glob . sync ( __dirname + '/**/*.route.*' ) ; routes . map ( route => register ( route , router ) ) ; } function register ( routePath , router ) { const route = require ( routePath ) ; route . register ( router ) ; }