<commit_before>/** Mixin: Barefoot.APIAdapter.Server
 * The server mixin for the <APIAdapter> takes the specified apiRoutes and does
 * two things:
 * * Create RESTful API routes with Express.JS, callable via HTTP
 * * Map server-side API calls to the correct local callback
 *
 * The creation of the Express.JS routes is done on initialization. The mapping
 * of server-side API calls is executed during runtime.
 *
 * Function Mapping:
 * The following matrix describes which function of <APIAdapter.Server> is
 * related to which task:
 *
 * >                          + REST API + Local API +
 * > +------------------------+----------+-----------+
 * >  processCallbacks        |    X     |     X     |
 * >  createExpressJsCallback |    X     |           |
 * >  createExpressJsRoute    |    X     |           |
 * >  urlRegexp               |          |     X     |
 * >  matchRoute              |          |     X     |
 * >  addRoute                |    X     |     X     |
 * >  createRouteFactories    |    X     |     X     |
 * >  dispatchLocalApiCall    |          |     X     |
 * >  sync                    |          |     X     |
 * > +------------------------+----------+-----------+
 */
var _ = require('underscore')
	, winston = require('winston')
	, httpMethods = require('methods')
	, methodMap = {
		'create': 'post'
		, 'update': 'put'
		, 'patch': 'patch'
		, 'delete': 'delete'
		, 'read': 'get'
	}
	, debug = require('debug')('barefoot:server:apiadapter');


/** Function: toString<commit_msg>`delete` is a reserved word - rename to `del`<commit_after>/** Mixin: Barefoot.APIAdapter.Server
 * The server mixin for the <APIAdapter> takes the specified apiRoutes and does
 * two things:
 * * Create RESTful API routes with Express.JS, callable via HTTP
 * * Map server-side API calls to the correct local callback
 *
 * The creation of the Express.JS routes is done on initialization. The mapping
 * of server-side API calls is executed during runtime.
 *
 * Function Mapping:
 * The following matrix describes which function of <APIAdapter.Server> is
 * related to which task:
 *
 * >                          + REST API + Local API +
 * > +------------------------+----------+-----------+
 * >  processCallbacks        |    X     |     X     |
 * >  createExpressJsCallback |    X     |           |
 * >  createExpressJsRoute    |    X     |           |
 * >  urlRegexp               |          |     X     |
 * >  matchRoute              |          |     X     |
 * >  addRoute                |    X     |     X     |
 * >  createRouteFactories    |    X     |     X     |
 * >  dispatchLocalApiCall    |          |     X     |
 * >  sync                    |          |     X     |
 * > +------------------------+----------+-----------+
 */
var _ = require('underscore')
	, winston = require('winston')
	, httpMethods = require('methods')
	, methodMap = {
		'create': 'post'
		, 'update': 'put'
		, 'patch': 'patch'
		, 'delete': 'del'
		, 'read': 'get'
	}
	, debug = require('debug')('barefoot:server:apiadapter');


/** Function: toString
{'fraction_non_alphanumeric': 0.1704138155751059, 'fraction_numerical': 0.0, 'mean_word_length': 1.5163934426229508, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5371071', 'n_tokens_mistral': 878, 'n_tokens_neox': 847, 'n_words': 238}