Defines a route w/ callback and method
339054
public function command($command, $method) {

        self::$commands[] = $command;
        self::$callbacks[$command] = $method;
    }
144982
function patchRoute(lookup) {
  // Save off the original method in scope of the prototype modifications.
  let originalRouteMethod = Ember.RouterDSL.prototype.route;

  // We need to do a few things before and after the original route function.
  Ember.RouterDSL.prototype.route = function(name, options, callback) {
    Ember.assert('You may not include a "." in your route name.', !~name.indexOf('.'));

    // Method signature identification from the original method.
    if (arguments.length === 2 && typeof options === 'function') {
      callback = options;
      options = {};
    }

    if (arguments.length === 1) {
      options = {};
    }

    // Save off a reference to the original arguments in a reachable scope.
    // This is so later calls to `alias` have something to find.
    if (!this.handlers) { this.handlers = {}; }
    this.handlers[name] = [ options, callback ];

    // For storing the root of the aliased route.
    if (!this.intercepting) { this.intercepting = []; }

    // So, we're "recursing" through a structure, but we can sneak in by wrapping the invoked function.
    if (this.intercepting.length) {

      // Make the callback modify the DSL generated for nested routes.
      // Necessary so they can register themselves.
      // Propogate the original interception information forward.
      var currentIntercepting = this.intercepting[this.intercepting.length - 1];
      let interceptingCallback = function() {
        this.intercepting = [currentIntercepting];
        callback.call(this);
      };

      // Figure out how many routes we created.
      let originalLength = [].concat.apply([], this.matches).length;
      originalRouteMethod.call(this, name, options, callback ? interceptingCallback : undefined);
      let newMatches = [].concat.apply([], this.matches);
      let newLength = newMatches.length;

      // Add each of them to the lookup.
      for (let i = originalLength; i < newLength; i += 3) {
        let intermediate = newMatches[i + 1].split('.');
        let qualifiedAliasRoute = intermediate.join('/');
        let qualifiedTargetRoute = qualifiedAliasRoute.replace(currentIntercepting.aliasRoute, currentIntercepting.aliasTarget);

        if (qualifiedAliasRoute !== qualifiedTargetRoute) {
          lookup[qualifiedAliasRoute] = qualifiedTargetRoute;
        } else {
          // For index routes we need to try again with the base intercepting object.
          let isIndex = intermediate.pop().indexOf('index') === 0;
          qualifiedTargetRoute = qualifiedAliasRoute.replace(this.intercepting[0].aliasRoute, this.intercepting[0].aliasTarget);
          if (isIndex && qualifiedAliasRoute !== qualifiedTargetRoute) {
            lookup[qualifiedAliasRoute] = qualifiedTargetRoute;
          }
        }
      }

    } else {
      originalRouteMethod.call(this, name, options, callback);
    }
  };
}
820060
function (method, endpoint, routerMiddelware) {
		var self = this;

		if (typeof routerMiddelware == 'object'){
			this.app[method](endpoint, function (req, res, next) {
				var middlewareFunction = []
				routerMiddelware.forEach(function (m) {
					middlewareFunction.push(function (cb) {
						self.__exec__middlewares(m, req, res, cb);
					});
				});

				async.waterfall(middlewareFunction);
			});
		} else {
			this.app[method](endpoint, function (req, res, next) {
				self.__exec__middleware(routerMiddelware)(req, res, next);
			});
		}
	}
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()
                    });
                }

            }
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);
  }
233783
function (object) {
        ACCEPTABLE_METHODS.forEach(function (method) {
            /**
             * Bind the provided route with a specific method to the callback provided.
             * Since you cannot specify a route more than once, it is required to use bind to provide multiple methods.
             *
             * @param {String} routeName The name of the route. Should be a JavaScript identifier. Optional.
             * @param {String} route The URL for the route.
             * @param {Function} callback The callback to be called when the route is accessed.
             *
             * @throws Error the routeName is already specified
             * @throws Error the route is already specified
             * @throws Error the route does not start with "/"
             * @throws Error an unknown route converter was specified
             *
             * @api public
             * 
             * @example routes.get("/", function(request, response) {
             *     response.end("GET /");
             * });
             * @example routes.post("item", "/{name}", function(request, response, params) {
             *     response.end("GET /" + params.name);
             * });
             */
            object[method] = function (routeName, route, callback) {
                if (arguments.length === 2) {
                    callback = route;
                    route = routeName;
                    routeName = null;
                }
                var descriptor = {};
                descriptor[method] = callback;
                if (arguments.length === 2) {
                    return this.bind(route, descriptor);
                } else {
                    return this.bind(routeName, route, descriptor);
                }
            };
        });
        object.del = object.delete;
    }
683426
function() {
      // Used for de-duping
      var paths = {};

      // Each controller has a `routes` object
      // Connect all routes defined in controllers
      _.forEach(router.controllers, function(controller) {
        _.forEach(controller.routes, function(route, method) {
          _.forEach(route, function(routeOptions, path) {
            // If path/method has already been defined, skip
            if (paths[path] === method) {
              debug.warn('Skipping duplicate route: [%s] %s', method, path);
              return;
            }

            // If no route action is defined, skip
            if (!routeOptions.action) {
              debug.warn('No action defined for route: [%s] %s', method, path);
              return;
            }

            // Setup controller scoped middleware
            // These apply to all routes in the controller
            var pre = _.invokeMap(controller.pre, 'bind', controller) || [];
            var before = _.invokeMap(controller.before, 'bind', controller) || [];
            var after = _.invokeMap(controller.after, 'bind', controller) || [];

            // Setup route scoped middleware
            // These apply only to this route
            var middleware = routeOptions.middleware || [];

            // Build the route handler (callback)
            var handler = router._buildHandler(controller, routeOptions);

            // Connect the route
            router[method](path, pre, middleware, before, handler, after);

            // Add route to set of connected routes
            router.routes.push({
              url: router.url,
              method: method,
              path: path
            });

            // Use for de-duping
            paths[path] = method;
          });
        });
      });

      // Debug logging
      _.forEach(router.routes, function(route) {
        debug.info('Route [%s] %s', route.method, route.url + route.path);
      });
    }
598542
async def route_wrapper(self, route, request, context, request_args,
                            request_kw, *decorator_args, with_context=None,
                            **decorator_kw):
        
        # by default, do nothing, just run the wrapped function
        if with_context:
            resp = route(request, context, *request_args, **request_kw)
        else:
            resp = route(request, *request_args, **request_kw)
        if isawaitable(resp):
            resp = await resp
        return resp
640416
function defineRoute (server, opts) {

    server.route({
        method: 'GET',
        path: '/bomb',
        handler: handler,
        config: {
            jsonp: 'callback',
            validate: {
                query: {
                    count: Hapi.types.Number()
                },
                payload: false
            }
        }
    });

    function handler (req) {
        var count = (req.query.count || opts.defaultBombCount);
        var res = {};
        res[opts.plural] = _.sample(opts.things, count);
        req.reply(res);
    }

}
908094
function(route, name, callback) {
      if (!_.isRegExp(route)) route = this._routeToRegExp(route);
      if (typeof name === 'function') {
        callback = name;
        name = '';
      }
      if (!callback) callback = this[name];
      var router = this;
      BackboneContext.history.route(route, function(fragment) {
        var args = router._extractParameters(route, fragment);
        if (router.execute(callback, args, name) !== false) {
          router.trigger.apply(router, ['route:' + name].concat(args));
          router.trigger('route', name, args);
          BackboneContext.history.trigger('route', router, name, args);
        }
      });
      return this;
    }
990275
function(){
    // set up router
    router.route(/^\/(active|completed)$/).param(0).as(function(subset){
      Todo.selected.set(Todo[subset || 'all']);
    });

    // return app root node
    return new Node({
      template: resource('./app/template/layout.tmpl'),
      binding: {
        // nested views
        form: resource('./module/form/index.js'),
        list: resource('./module/list/index.js'),
        stat: resource('./module/stat/index.js')
      }
    });
  }
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;
}
357114
def bind(cls, app, *paths, methods=None, name=None, router=None, view=None):
        """"""
        cls.app = app
        if cls.app is not None:
            for _, m in inspect.getmembers(cls, predicate=inspect.isfunction):
                if not hasattr(m, ROUTE_PARAMS_ATTR):
                    continue
                paths_, methods_, name_ = getattr(m, ROUTE_PARAMS_ATTR)
                name_ = name_ or ("%s.%s" % (cls.name, m.__name__))
                delattr(m, ROUTE_PARAMS_ATTR)
                cls.app.register(*paths_, methods=methods_, name=name_, handler=cls)(m)

        @coroutine
        @functools.wraps(cls)
        def handler(request):
            return cls().dispatch(request, view=view)

        if not paths:
            paths = ["/%s" % cls.__name__]

        return routes_register(
            app, handler, *paths, methods=methods, router=router, name=name or cls.name)
150057
def cli(self, method):
        """"""
        routes = getattr(method, '_hug_cli_routes', [])
        routes.append(self.route)
        method._hug_cli_routes = routes
        return method
273417
function(route, name, callback) {
    if (_.isFunction(name)) {
      callback = name;
      name = '';
    }

    if (!_.isRegExp(route)){
      route = this._routeToRegExp(route);
    }

    if (!callback){ callback = this[name]; }
    Backbone.history.route(route, (fragment) => {

      // If this route was defined as a regular expression, we don't capture
      // query params. Only parse the actual path.
      fragment = fragment.split('?')[0];

      // Extract the arguments we care about from the fragment
      var args = this._extractParameters(route, fragment);

      // Get the query params string
      var search = (Backbone.history.getSearch() || '').slice(1);

      // If this route was created from a string (not a regexp), remove the auto-captured
      // search params.
      if(route._isString){ args.pop(); }

      // If the route is not user prodided, if the history object has search params
      // then our args have the params as its last agrument as of Backbone 1.2.0
      // If the route is a user provided regex, add in parsed search params from
      // the history object before passing to the callback.
      args.push((search) ? $.url.query.parse(search) : {});

      var resp = this.execute(callback, args, name);
      if ( resp !== false) {
        this.trigger.apply(this, ['route:' + name].concat(args));
        this.trigger('route', name, args);
        Backbone.history.trigger('route', this, name, args);
      }
      return resp;
    });
    return this;
  }
4138
private static function routeAction()
    {
        $actionQueryString = Request::getInputValue("do", false, true);
        $actionQuery = Actions::parseActionQueryString($actionQueryString);
        
        Addons::executeComponentFunction($actionQuery->name, $actionQuery->method, @$actionQuery->arguments);
    }
262831
function route (message, cb) {
    assert(message, 'route requries a valid message')
    assert(cb && (typeof cb === 'function'), 'route requires a valid callback handler')

    if (message.pattern) {
      return pattern(message, cb)
    }

    if (message.response) {
      return response(message, cb)
    }

    malformed(message, cb)
  }