PrivateFunction: createExpressJsRoute
Creates an Express.JS request handlers.

It takes an object containing route URI's like "/contacts" or
"/contacts/:name" as key and callback functions as values.
Using the passed Express.JS route-creation-function "binder" (app.post,
app.put etc.), an Express.JS route is created.

Each route callback is wrapped into an Express.JS specific handler function
connected to the route URI. Combined with the Express.JS body parser
middleware, the first argument of your callback will contain the body of the
request. If your route defines any parameters ("/contacts/:id"), the specific
values are passed as function arguments. If the request specifies any query
parameters ("/contacts?message=test&limit=1"), you'll find an object literal
containing all these key-value pairs at the end of your callback arguments
list.

Beside the return value of the callback, the wrapper function sends
automatically an HTTP OK (200) to the request creator. If the callback throws
an error object, that object is inspected for an "httpStatusCode" property.
If present, that status code is delivered to the requestor. If not, an HTTP
Internal Server Error (500) is sent.

For a set of errors with predefined HTTP status codes, see <Barefoot.Errors>.

Parameters:
(Object) url - URL route to bind
(Function)/(Array) callbacks - An API function which should be executed.
If you pass an array with functions, each
function gets executed as it is stacked
upon the array.
(Function) expressJsMethod - A function of Express.JS like app.get etc.
(Object) app -  The Express.JS app

See also:
* <Barefoot.Errors>
function createExpressJsRoute(url, callbacks, expressJsMethod, app) {
	debug('creating express.js route for url `%s`', url);

	var self = this
		, expressJsHandler = createExpressJsCallback(
			function success(apiResult, httpStatusCode) {
				httpStatusCode = httpStatusCode || 200;
				this.res.send(httpStatusCode, apiResult);
			}
			, function error(err) {
				var message
					, stack
					, httpStatusCode = 500;

				if(!_.isUndefined(err)) {
					if(_.has(err, 'httpStatusCode')) {
						httpStatusCode = err.httpStatusCode;
					}
					message = err.toString() || err;
					stack = err.stack || undefined;
				}

				this.res.send(httpStatusCode, message);
				winston.log('error', 'API callback stopped with error', {
					source: self.toString()
					, apiRoute: url
					, err: message
					, stack: stack
				});
			}
			, callbacks
			, app);

	expressJsMethod.call(app, url, expressJsHandler);
}