Extends the Express Route class to support Swagger.
@param {string} path
@constructor
@extends {e.Route}
350616
function Route(path) {
  // Convert Swagger-style path to Express-style path
  path = path.replace(util.swaggerParamRegExp, ':$1');
  express.Route.call(this, path);
}
440781
function MiddlewareContext (router) {
  events.EventEmitter.call(this);

  /**
   * Express routing options (e.g. `caseSensitive`, `strict`).
   * If set to an Express Application or Router, then its routing settings will be used.
   * @type {express#Router}
   */
  this.router = router || {};

  /**
   * The parsed Swagger API
   * @type {SwaggerObject}
   */
  this.api = null;

  /**
   * The {@link SwaggerParser} instance that was used to parse the API.
   * @type {SwaggerParser}
   */
  this.parser = null;

  /**
   * If the Swagger API contains errors, this will be set
   * @type {Error}
   */
  this.error = null;
}
1303990
function Route(path,content,operation){
	if(typeof(path) === 'string'){
		if(path === '*') path = '.*';
		path = new RegExp(path);
	}
	if(typeof(content) === 'string'){
		if(content === '*') content = '.*';
		content = new RegExp(content);
	}
	this.path = path;
	this.content = content;
	this.operation = operation;
}
705681
function initRoutes (config, route) {
    // create express router for route
    route.router = express.Router({
        caseSensitive: true,
        strict: true,
    })
    // initialize routes depth first so that explicit nested paths come
    // before wildcard paths and are handled correctly by express router
    _.each(route.routes, (subRoute, path) => {
        // get router for sub route
        var router = initRoutes(config, subRoute)
        // bind route for path
        route.router.use('/'+path+'/', router)
    })
    // clear model if no properties are set
    if (_.keys(route.model).length === 0) {
        route.model = undefined
    }
    // clear controller if no properties are set
    if (_.keys(route.controller).length === 0) {
        route.controller = undefined
    }
    // instantiate ImmutableCoreModel
    if (defined(route.model)) {
        route.model = new ImmutableCoreModel(route.model)
        // add model to app register
        config.models[route.model.name] = route.model
    }
    // if model is not set use model for this node
    if (defined(route.controller) && !defined(route.controller.model)) {
        route.controller.model = route.model
    }
    // instantiate ImmutableCoreController - this will create default controllers
    // for model
    var controller = route.controller = new ImmutableCoreController(route.controller)
    // get all templates then remove those that have controllers
    var bareTemplates = _.cloneDeep(route.templates)
    // iterate over paths
    _.each(controller.paths, path => {
        // iterate over http methods for path
        _.each(path, methods => {
            // iterate over handlers for different roles
            _.each(methods, spec => {
                // role can be specific or default to all
                var role = spec.role || 'all'
                // template can be specified or take from method name
                var template = spec.template || spec.methodName
                // template name exists locally
                if (defined(route.templates[template])) {
                    // if there is a template for the controllers role then remove
                    // it from the list of unused templates
                    if (defined(bareTemplates[template].role[role])) {
                        delete bareTemplates[template].role[role]
                    }
                    // otherwise if there is a template for all roles then assign
                    // it to this controller so that another controller for the
                    // all role will not be created to serve the template
                    else if (defined(bareTemplates[template].role['all'])) {
                        delete bareTemplates[template].role['all']
                    }
                }
            })
        })
    })
    // set to true if any controllers addded
    var added = false
    // create paths for any templates without controllers
    _.each(bareTemplates, (template, templateName) => {
        // iterate over any templates for roles that have not been used
        _.each(template.role, (templatePath, role) => {
            // get path from template name with index becoming /
            var path = templateName === 'index' ? '/' : '/'+templateName
            // create entry for path in controller if not yet defined
            if (!controller.paths[path]) {
                controller.paths[path] = {}
            }
            // create entry for method if not yet defined
            if (!controller.paths[path]['get']) {
                controller.paths[path]['get'] = []
            }
            // add spec for template to controller
            controller.paths[path]['get'].push({
                role: role,
                template: templatePath,
            })
        })
    })
    // if controllers were added then need to reorder controllers
    if (added) {
        controller.orderControllers()
    }
    // get list of path names
    var pathNames = _.keys(controller.paths)
    // sort path names so that static names go above onces with placeholders
    var sortedPathNames = pathNames.sort(sortPlaceholdersLower)
    // create routes for controller paths
    _.each(sortedPathNames, path => {
        var methods = controller.paths[path]
        // add route for each method
        _.each(methods, (spec, method) => {
            // create ImmutableAppPresenter instance
            var presenter = new ImmutableAppPresenter({
                config: config,
                method: method,
                module: module,
                path: path,
                route: route,
                spec: spec,
            })
            // middleware for route
            var routeMiddleware = []
            // iterate over spec(s) for different roles
            _.each(spec, roleSpec => {
                // if spec has middleware add to router
                _.each(roleSpec.middleware, middleware => {
                    routeMiddleware.push(middleware)
                })
            })
            // add presenter as final middleware
            routeMiddleware.push(presenter)
            // add path to router with method
            route.router[method](path, routeMiddleware)
        })
    })
    // return router so it can be bound to parent
    return route.router
}
1230779
def add_view(self, path: str, handler: AbstractView,
                 **kwargs: Any) -> AbstractRoute:
        
        return self.add_route(hdrs.METH_ANY, path, handler, **kwargs)
333930
public static RouteImpl create(final String path, final Route route) {
        return create(path, DEFAULT_ACCEPT_TYPE, route);
    }
1328262
function (module) {
                _.defaults(module, {
                    name: null,
                    moduleClass: null,
                    route: null,
                    attributes: null,
                    relative: false
                });

                if (!module.name) {
                    throw "module cannot be added: module name is required";
                }

                if (!module.moduleClass) {
                    throw "no moduleClass defined for module";
                }

                if (this.$modules.hasOwnProperty(module.name)) {
                    throw "module with name '" + module.name + "' already registered";
                }

                this.$modules[module.name] = module;

                if (module.route) {
                    if (!this.$.router) {
                        throw "defining modules with routes requires a router instance to be set";
                    }

                    var self = this;
                    this.$.router.addRoute({
                        name: module.name,
                        route: module.route,
                        fn: function (routeContext) {

                            // route triggered -> load module
                            self.loadModule(module, routeContext.callback, routeContext);
                        }.async()
                    });
                }

            }
1244068
function koifyRoute(Route) {
	let routePrototype = Route.prototype;
	let routePrototype_ = {};

	for (let method of [...methods, 'all']) {
		routePrototype_[method] = routePrototype[method];
		routePrototype[method] = function () {
			let args = slice.call(arguments);

			for (let i = 0; i < args.length; i++) {
				let handler = args[i];

				if (isFunction(handler)) {
					args[i] = ko.ko(handler);
				}
			}

			return routePrototype_[method].apply(this, args);
		};
	}

	return Route;
}
981379
function(routes, callback) {
    var newRoutes = {};

    // Add a route.
    newRoutes['/test'] = {
      callback: function(request, response) {
        response.send('Testing!');
      }
    };

    // Add another route.
    newRoutes['/test-altering'] = {
      callback: function(request, response) {
        response.send('Testing!');
      }
    };

    callback(null, newRoutes);
  }
945968
function Route (pattern, base, fn, options) {
    this.pattern = RoutePattern.fromString(pattern);
    this.options = options || {};
    this.fn = fn;

    if (base) {
        this.extendFrom(base);
    }
}
1108204
function require(path) {
  var module = require.modules[path];
  if(!module) {
    throw("couldn't find module for: " + path);
  }
  if(!module.exports) {
    module.exports = {};
    module.call(module.exports, module, module.exports, require.bind(path));
  }
  return module.exports;
}
1113586
function (path) {
        return new Promise((resolve, reject) => {
            fs.access(path, fs.constants.F_OK, (err) => {
                if (err === null) {
                    resolve(true);
                }
                else if (err.code === 'ENOENT') {
                    resolve(false);
                }
                else {
                    reject(err);
                }
            });
        });
    }
1002748
function override(route, thing) {

		// Resolve module location from given path
		const filename = _require.resolve(route);

		// Load it into memory
		_require(filename);

		// Override exports with new value
		_require.cache[filename].exports = thing;

		// Return exports value
		return _require(filename);
	}
856308
function get(path) {
    return defineRouteProperty([{ name: "path", args: [path || ""] }, { name: "method", args: [appolo_agent_1.Methods.GET] }]);
}
1067548
def for(path, *args)
      arg = args[0]
      log.debug "Adding route, path: #{path}, args: #{args.inspect}"

      match = get_regex_for_route(path, arg)
      hash = get_to_hash(arg)
      route_info = {:regex => match[:regex], :args => arg, :vars => match[:vars], :hash => hash}
      
      # Add the HTTP methods for this route if they exist in options
      route_info[:methods] = arg[:methods] if not arg.nil? and arg.has_key? :methods
      
      self.routes.push(route_info)
    end
1218553
function extendHttpRequest(req) {
    req = req || express.request;

    /**
     * get param value from path-variable or query or body or headers.
     * @param {string} paramName
     * @param {*} [fallback]
     * @returns {*}
     */
    req.anyParam = function (paramName, fallback) {
        return (this.params && this.params[paramName]) || // path-variable
            (this.query && this.query[paramName]) ||
            (this.body && this.body[paramName]) ||
            (this.get && this.get(paramName)) || // header
            fallback;
    };

    /**
     * get string param from http request.
     *
     * @param {String} paramName
     * @param {String} [fallback]
     * @returns {String} param value
     * @throws {errors.BadRequest} no string param acquired and no fallback provided
     * @memberOf {express.request}
     */
    req.strParam = function (paramName, fallback) {
        var paramValue = this.anyParam(paramName);
        if (paramValue !== undefined) {
            return paramValue;
        }
        if (fallback !== undefined) {
            return fallback;
        }
        throw new errors.BadRequest('param_required:' + paramName);
    };

    /**
     * get integer param from http request.
     *
     * @param {String} paramName
     * @param {Number} [fallback]
     * @returns {Number} param value
     * @throws {errors.BadRequest} no integer param acquired and no fallback provided
     * @memberOf {express.request}
     */
    req.intParam = function (paramName, fallback) {
        var paramValue = utils.toInt(this.anyParam(paramName), fallback);
        if (paramValue !== undefined) {
            return paramValue;
        }
        if (fallback !== undefined) {
            return fallback;
        }
        throw new errors.BadRequest('int_param_required:' + paramName);
    };

    /**
     * get number(float) param from http request.
     *
     * @param {String} paramName
     * @param {Number} [fallback]
     * @returns {Number} param value
     * @throws {errors.BadRequest} no number param acquired and no fallback provided
     * @memberOf {express.request}
     */
    req.numberParam = function (paramName, fallback) {
        var paramValue = utils.toNumber(this.anyParam(paramName));
        if (paramValue !== undefined) {
            return paramValue;
        }
        if (fallback !== undefined) {
            return fallback;
        }
        throw new errors.BadRequest('number_param_required:' + paramName);
    };

    /**
     * get boolean param from http request.
     *
     * @param {String} paramName
     * @returns {Boolean} [fallback]
     * @returns {Boolean} param value
     * @throws {errors.BadRequest} no boolean param acquired and no fallback provided
     * @memberOf {express.request}
     */
    req.boolParam = function (paramName, fallback) {
        var paramValue = utils.toBoolean(this.anyParam(paramName));
        if (paramValue !== undefined) {
            return paramValue;
        }
        if (fallback !== undefined) {
            return fallback;
        }
        throw new errors.BadRequest('bool_param_required:' + paramName);
    };

    /**
     * get date param from http request.
     *
     * @param {String} paramName
     * @param {Date} [fallback]
     * @returns {Date} param value
     * @throws {errors.BadRequest} no date param acquired and no fallback provided
     * @memberOf {express.request}
     */
    req.dateParam = function (paramName, fallback) {
        var paramValue = Date.parse(this.anyParam(paramName));
        if (!isNaN(paramValue)) {
            return new Date(paramValue);
        }
        if (fallback !== undefined) {
            return fallback;
        }
        throw new errors.BadRequest('date_param_required:' + paramName);
    };

    /**
     * collect params from http request.
     *
     * @param {Array.<String>} paramNames
     * @returns {Object.<String,String>}
     */
    req.collectParams = function (paramNames) {
        var self = this;
        return paramNames.reduce(function (params, paramName) {
            var paramValue = self.strParam(paramName);
            if (paramValue) {
                params[paramName] = paramValue.trim();
            }
            return params;
        }, {});
    };
}
789795
function (path) {
    let classes = [];

    let files = fs.readdirSync(path);
    for (let i = 0; i < files.length; i++) {
      let clazz = require(path + '/' + files[i]);
      classes.push(clazz);
    }

    return classes;
  }