<commit_before>/**
 * route.js
 *
 * Defines the Route class, which provides wrapper methods around Express
 * routes.
 */

var Handler = require('./handler');

/**
 * Constructor. Takes in a RestAPI instance and a path for the route.
 */
function Route(restApi, path) {
	this.restApi = restApi;
	this.path = path;

	this.expressRoute = restApi.expressApp.route(path);
}

Route.prototype._addHandler = function(method) {
	// all arguments after 'method' should be a function handler
	var funcs = Array.prototype.slice.call(arguments, 1);

	this.expressRoute[method](new Handler(funcs));
}

/**
 * Define GET handlers for the route.
 */
Route.prototype.get = function() {
	var callWith = ['get'].concat(Array.prototype.slice.call(arguments));

	this._addHandler.apply(this, callWith);
}

/**
 * Define PUT handlers for the route.
 */
Route.protoype.put = function() {
	var callWith = ['put'].concat(Array.protoype.slice.call(arguments));

	this._addHandler.apply(this, callWith);
}

/**
 * Define POST handlers for the route.
 */
Route.prototype.post = function() {
	var callWith = ['post'].concat(Array.protoype.slice.call(arguments));

	this._addHandler.apply(this, callWith);
}

/**
 * Define DELETE handlers for the route.
 */
Route.prototype.delete = function() {
	var callWith = ['delete'].concat(Array.protoype.slice.call(arguments));

	this._addHandler.apply(this, callWith);
}

module.exports = Route;

<commit_msg>Fix typo.<commit_after>/**
 * route.js
 *
 * Defines the Route class, which provides wrapper methods around Express
 * routes.
 */

var Handler = require('./handler');

/**
 * Constructor. Takes in a RestAPI instance and a path for the route.
 */
function Route(restApi, path) {
	this.restApi = restApi;
	this.path = path;

	this.expressRoute = restApi.expressApp.route(path);
}

Route.prototype._addHandler = function(method) {
	// all arguments after 'method' should be a function handler
	var funcs = Array.prototype.slice.call(arguments, 1);

	this.expressRoute[method](new Handler(funcs));
}

/**
 * Define GET handlers for the route.
 */
Route.prototype.get = function() {
	var callWith = ['get'].concat(Array.prototype.slice.call(arguments));

	this._addHandler.apply(this, callWith);
}

/**
 * Define PUT handlers for the route.
 */
Route.prototype.put = function() {
	var callWith = ['put'].concat(Array.protoype.slice.call(arguments));

	this._addHandler.apply(this, callWith);
}

/**
 * Define POST handlers for the route.
 */
Route.prototype.post = function() {
	var callWith = ['post'].concat(Array.protoype.slice.call(arguments));

	this._addHandler.apply(this, callWith);
}

/**
 * Define DELETE handlers for the route.
 */
Route.prototype.delete = function() {
	var callWith = ['delete'].concat(Array.protoype.slice.call(arguments));

	this._addHandler.apply(this, callWith);
}

module.exports = Route;


{'fraction_non_alphanumeric': 0.15160042208934224, 'fraction_numerical': 0.0007034822370735139, 'mean_word_length': 4.276437847866419, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1397860', 'n_tokens_mistral': 908, 'n_tokens_neox': 885, 'n_words': 217}