lib/resource-handler-spec.js
function createNodeHandlerSpec( routeDefinition, resource ) {

	const handler = {
		// A "path" is an ordered (by key) set of values composed into the final URL
		_path: {
			'0': resource,
		},

		// A "level" is a level-keyed object representing the valid options for
		// one level of the resource URL
		_levels: {},

		// Objects that hold methods and properties which will be copied to
		// instances of this endpoint's handler
		_setters: {},

		// Arguments (query parameters) that may be set in GET requests to endpoints
		// nested within this resource route tree, used to determine the mixins to
		// add to the request handler
		_getArgs: routeDefinition._getArgs,
	};

	// Walk the tree
	Object.keys( routeDefinition ).forEach( ( routeDefProp ) => {
		if ( routeDefProp !== '_getArgs' ) {
			extractSetterFromNode( handler, routeDefinition[ routeDefProp ] );
		}
	} );

	return handler;
}
function createNodeHandlerSpec( routeDefinition, resource ) {

	const handler = {
		// A "path" is an ordered (by key) set of values composed into the final URL
		_path: {
			'0': resource,
		},

		// A "level" is a level-keyed object representing the valid options for
		// one level of the resource URL
		_levels: {},

		// Objects that hold methods and properties which will be copied to
		// instances of this endpoint's handler
		_setters: {},

		// Arguments (query parameters) that may be set in GET requests to endpoints
		// nested within this resource route tree, used to determine the mixins to
		// add to the request handler
		_getArgs: routeDefinition._getArgs,
	};

	// Walk the tree
	Object.keys( routeDefinition ).forEach( ( routeDefProp ) => {
		if ( routeDefProp !== '_getArgs' ) {
			extractSetterFromNode( handler, routeDefinition[ routeDefProp ] );
		}
	} );

	return handler;
}
function createNodeHandlerSpec ( routeDefinition , resource ) { const handler = { // A "path" is an ordered (by key) set of values composed into the final URL _path : { '0' : resource , } , // A "level" is a level-keyed object representing the valid options for // one level of the resource URL _levels : { } , // Objects that hold methods and properties which will be copied to // instances of this endpoint's handler _setters : { } , // Arguments (query parameters) that may be set in GET requests to endpoints // nested within this resource route tree, used to determine the mixins to // add to the request handler _getArgs : routeDefinition . _getArgs , } ; // Walk the tree Object . keys ( routeDefinition ) . forEach ( ( routeDefProp ) => { if ( routeDefProp !== '_getArgs' ) { extractSetterFromNode ( handler , routeDefinition [ routeDefProp ] ) ; } } ) ; return handler ; }
Create a node handler specification object from a route definition object

@name create
@param {object} routeDefinition A route definition object
@param {string} resource The string key of the resource for which to create a handler
@returns {object} A handler spec object with _path, _levels and _setters properties
Create a node handler specification object from a route definition object