lib/espresso/dispatchRequest.js
function(resource) {
        var handler = resource.handler.getCallback(request.method);

        request.api.handler = handler;
        request.path = resource.path;

        var context = resource.handler.getContext();
        context.__espressojs = {
            chainIsComplete: chainIsComplete,
            // Reference to the currently processed handler
            handler: resource.handler,

            // Currently processed path
            path: resource.path
        };

        return context;
    }
function(resource) {
        var handler = resource.handler.getCallback(request.method);

        request.api.handler = handler;
        request.path = resource.path;

        var context = resource.handler.getContext();
        context.__espressojs = {
            chainIsComplete: chainIsComplete,
            // Reference to the currently processed handler
            handler: resource.handler,

            // Currently processed path
            path: resource.path
        };

        return context;
    }
function ( resource ) { var handler = resource . handler . getCallback ( request . method ) ; request . api . handler = handler ; request . path = resource . path ; var context = resource . handler . getContext ( ) ; context . __espressojs = { chainIsComplete : chainIsComplete , // Reference to the currently processed handler handler : resource . handler , // Currently processed path path : resource . path } ; return context ; }
Helper function used to prepare the handler invokation
Uses and manipulates 'global' state like `chainIsComplete` and `request`.

@param {object}  resource    A resource entry containing a path (`.path`)
and the corresponding Handler.

@return {object}             The `this` context for the resource handler.
Helper function used to prepare the handler invokation Uses and manipulates global state like chainIsComplete and request .