index.js
function(actionName, action, resourcePath) {
		// prefix function to set rest values
		var identify = function(req, res, next) {
			res.set('XX-Powered-By', 'Restpress');
			req.resource = self;
			req.actionName = actionName;
			req.action = action;
			next();
		};

		self[actionName] = function() {
			if (identify) {
				// insert identify as second argument
				// This is to be done only once
				[].unshift.call(arguments, identify);
				identify = null;
			}

			// insert actionPath as first argument
			[].unshift.call(arguments, resourcePath + action.route);

			// Hack for restify where 'delete' method is 'del'
			var appMethod = action.method;
			if (appMethod == 'delete' &&
					typeof self.app[appMethod] !== 'function' &&
					typeof self.app['del'] === 'function') {
					appMethod = 'del';
			}

			// Call express app VERB function
			self.app[appMethod].apply(self.app, arguments);
			
			// return this for chaining
			return self;
		};
	}
function(actionName, action, resourcePath) {
		// prefix function to set rest values
		var identify = function(req, res, next) {
			res.set('XX-Powered-By', 'Restpress');
			req.resource = self;
			req.actionName = actionName;
			req.action = action;
			next();
		};

		self[actionName] = function() {
			if (identify) {
				// insert identify as second argument
				// This is to be done only once
				[].unshift.call(arguments, identify);
				identify = null;
			}

			// insert actionPath as first argument
			[].unshift.call(arguments, resourcePath + action.route);

			// Hack for restify where 'delete' method is 'del'
			var appMethod = action.method;
			if (appMethod == 'delete' &&
					typeof self.app[appMethod] !== 'function' &&
					typeof self.app['del'] === 'function') {
					appMethod = 'del';
			}

			// Call express app VERB function
			self.app[appMethod].apply(self.app, arguments);
			
			// return this for chaining
			return self;
		};
	}
function ( actionName , action , resourcePath ) { // prefix function to set rest values var identify = function ( req , res , next ) { res . set ( 'XX-Powered-By' , 'Restpress' ) ; req . resource = self ; req . actionName = actionName ; req . action = action ; next ( ) ; } ; self [ actionName ] = function ( ) { if ( identify ) { // insert identify as second argument // This is to be done only once [ ] . unshift . call ( arguments , identify ) ; identify = null ; } // insert actionPath as first argument [ ] . unshift . call ( arguments , resourcePath + action . route ) ; // Hack for restify where 'delete' method is 'del' var appMethod = action . method ; if ( appMethod == 'delete' && typeof self . app [ appMethod ] !== 'function' && typeof self . app [ 'del' ] === 'function' ) { appMethod = 'del' ; } // Call express app VERB function self . app [ appMethod ] . apply ( self . app , arguments ) ; // return this for chaining return self ; } ; }
Re-Create methods working via app for known actions
Re - Create methods working via app for known actions