hooks/routes/index.js
function processHandler(fn) {
                if (_.isFunction(handler)) {
                    return fn(null, handler);
                }
                if (_.isString(handler)) {
                    return self.processStringHandler(mycro, handler, fn);
                }
                if (_.isObject(handler)) {
                    // make sure the object defines a `handler` attribute
                    if (!handler.handler) {
                        return fn('Unable to locate handler for ' + verb.toUpperCase() + ' ' + path.toString());
                    }
                    // extend options with any route specific options
                    if (handler.options && _.isObject(handler.options)) {
                        _.extend(options.defaultOptions, handler.options);
                    }
                    // allow route to override policy chain
                    if (handler.policies && _.isArray(handler.policies)) {
                        options.defaultPolicies = handler.policies;
                    }
                    // allow route to augment policy chain
                    if (handler.additionalPolicies && _.isArray(handler.additionalPolicies)) {
                        options.defaultPolicies = options.defaultPolicies.concat(handler.additionalPolicies);
                    }
                    if (_.isFunction(handler.handler)) {
                        return fn(null, handler.handler);
                    }
                    if (_.isString(handler.handler)) {
                        return self.processStringHandler(mycro, handler.handler, fn);
                    }
                }
                return fn('Unsupported handler type for '+ verb.toUpperCase() + ' ' + path.toString());
            }
function processHandler(fn) {
                if (_.isFunction(handler)) {
                    return fn(null, handler);
                }
                if (_.isString(handler)) {
                    return self.processStringHandler(mycro, handler, fn);
                }
                if (_.isObject(handler)) {
                    // make sure the object defines a `handler` attribute
                    if (!handler.handler) {
                        return fn('Unable to locate handler for ' + verb.toUpperCase() + ' ' + path.toString());
                    }
                    // extend options with any route specific options
                    if (handler.options && _.isObject(handler.options)) {
                        _.extend(options.defaultOptions, handler.options);
                    }
                    // allow route to override policy chain
                    if (handler.policies && _.isArray(handler.policies)) {
                        options.defaultPolicies = handler.policies;
                    }
                    // allow route to augment policy chain
                    if (handler.additionalPolicies && _.isArray(handler.additionalPolicies)) {
                        options.defaultPolicies = options.defaultPolicies.concat(handler.additionalPolicies);
                    }
                    if (_.isFunction(handler.handler)) {
                        return fn(null, handler.handler);
                    }
                    if (_.isString(handler.handler)) {
                        return self.processStringHandler(mycro, handler.handler, fn);
                    }
                }
                return fn('Unsupported handler type for '+ verb.toUpperCase() + ' ' + path.toString());
            }
function processHandler ( fn ) { if ( _ . isFunction ( handler ) ) { return fn ( null , handler ) ; } if ( _ . isString ( handler ) ) { return self . processStringHandler ( mycro , handler , fn ) ; } if ( _ . isObject ( handler ) ) { // make sure the object defines a `handler` attribute if ( ! handler . handler ) { return fn ( 'Unable to locate handler for ' + verb . toUpperCase ( ) + ' ' + path . toString ( ) ) ; } // extend options with any route specific options if ( handler . options && _ . isObject ( handler . options ) ) { _ . extend ( options . defaultOptions , handler . options ) ; } // allow route to override policy chain if ( handler . policies && _ . isArray ( handler . policies ) ) { options . defaultPolicies = handler . policies ; } // allow route to augment policy chain if ( handler . additionalPolicies && _ . isArray ( handler . additionalPolicies ) ) { options . defaultPolicies = options . defaultPolicies . concat ( handler . additionalPolicies ) ; } if ( _ . isFunction ( handler . handler ) ) { return fn ( null , handler . handler ) ; } if ( _ . isString ( handler . handler ) ) { return self . processStringHandler ( mycro , handler . handler , fn ) ; } } return fn ( 'Unsupported handler type for ' + verb . toUpperCase ( ) + ' ' + path . toString ( ) ) ; }
process handler definition
process handler definition