bin/middleware.js
function loadController(controllersDirectory, controller, development) {
    const filePath = path.resolve(controllersDirectory, controller);
    try {
        return require(filePath);
    } catch (e) {
        if (e.code === 'MODULE_NOT_FOUND' && e.message.indexOf("Cannot find module '" + filePath + "'") === 0 && development) {
            console.error('Cannot find controller: ' + filePath);
            return null;
        } else {
            throw e;
        }
    }
}
function loadController(controllersDirectory, controller, development) {
    const filePath = path.resolve(controllersDirectory, controller);
    try {
        return require(filePath);
    } catch (e) {
        if (e.code === 'MODULE_NOT_FOUND' && e.message.indexOf("Cannot find module '" + filePath + "'") === 0 && development) {
            console.error('Cannot find controller: ' + filePath);
            return null;
        } else {
            throw e;
        }
    }
}
function loadController ( controllersDirectory , controller , development ) { const filePath = path . resolve ( controllersDirectory , controller ) ; try { return require ( filePath ) ; } catch ( e ) { if ( e . code === 'MODULE_NOT_FOUND' && e . message . indexOf ( "Cannot find module '" + filePath + "'" ) === 0 && development ) { console . error ( 'Cannot find controller: ' + filePath ) ; return null ; } else { throw e ; } } }
Attempt to load a node module as a controller.
@param {string} controllersDirectory
@param {string} controller
@param {boolean} development
@returns {*}
Attempt to load a node module as a controller .