def route(method, path, options={}, block)
   # TODO: remove&replace existing routes (on reload)
   router.routes.unshift({:method => method, :path => path, :options => options, :block => block})
 end
335930
def route(method, path)
      method_routes = self.routes.find_all{|x| x.method == method}
      method_routes.each do |route|
        if route.path =~ WILDCARD_PATTERN
          src = "\\A#{route.path.gsub('*','(.*)')}\\Z"
          if match = path.match(Regexp.new(src))
            return [route, match[1].split('/')]
          end
        elsif route.path =~ NAMED_SEGMENTS_PATTERN
          src = "\\A#{route.path.gsub(NAMED_SEGMENTS_REPLACEMENT_PATTERN, '/(?<\1>[^$/]+)')}\\Z"
          if match = path.match(Regexp.new(src))
            return [route, Hash[match.names.zip(match.captures)]]
          end
        elsif path == route.path
          return [route]
        end
      end
      nil
    end
1031418
def post(self, path=None, method='POST', **options):
        
        return self.route(path, method, **options)
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;
}
74808
def route(self, uri, methods=frozenset({'GET'}), host=None,
              strict_slashes=False, stream=False, websocket=False):
        '''
        '''

        # Fix case where the user did not prefix the URL with a /
        # and will probably get confused as to why it's not working
        if not uri.startswith('/'):
            uri = '/' + uri

        def response(handler):
            if websocket:
                handler.is_websocket = True
            elif stream:
                handler.is_stream = True
            self.router.add(uri=uri, methods=methods, handler=handler,
                            host=host, strict_slashes=strict_slashes)
            return handler

        return response
774524
def mkcol(path, options = {}, &block)
      perform_request Net::HTTP::Mkcol, path, options, &block
    end
936706
function (methods) {
    this.lazyRouter();
    this.router.method(methods);
    utils.arrayify(methods).forEach(function (method) {
      this.define(method, function(path) {
        var route = this.router.route(path);
        var args = [].slice.call(arguments, 1);
        route[method].apply(route, args);
        return this;
      }.bind(this));
    }.bind(this));
  }
316611
def (self, method):
        
        def _route(resource, handler, schema=None):
            """
            _route
            """
            route = self.routes.get(resource, Route(resource))
            route.__getattribute__(method)(handler, schema)
            self.routes.update({resource: route})
            return self

        return _route
676675
def root(to, options={})
      default = {path: '', to: to, method: :get, root: true}
      options = default.merge(options)
      @routes << Route.new(options)
    end
363452
def new_route(http_method, path, callback, options)
      route = ExtendedRoute.new
      route.path = path
      route.name = callback.method_name
      route.add_match_with(options)
      route.add_request_method(http_method)
      route.add_request_method("HEAD") if http_method == "GET"
      route
    end
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
868802
function route(method, path, handler, config) {

    if( (typeof method !== 'string' && !Array.isArray(method))
        || (typeof path !== 'string')
        || (typeof handler !== 'function' && typeof handler !== 'string' && typeof handler !== 'object')
        || (config != null && typeof config !== 'object') ) {
        throw new TypeError('Bad arguments');
    }

    if (typeof method === 'string') {
        method = method.toUpperCase().replace(/\s+/g, ' ').trim().replace(/^DEL$/, 'DELETE');
        if (method.match(/ /)) {
            method = method.split(' ');
        }
    }
    if (Array.isArray(method)) {
        method = method.map(function (x) {
            return x.toUpperCase().replace(/\s+/g, ' ').trim().replace(/^DEL$/, 'DELETE');
        });
        method.forEach(function (elem) {
            if (elem.match(/[^A-Z*]/)) {
                throw new TypeError('Bad arguments');
            }
        });
    }
    return {
        method: method,
        path: path,
        handler: handler,
        config: config
    };
}
1282508
function Route(method, route, fn) {
    this.method = method;
    this.route = route;
    this.fn = fn;

    return function (app) {
        var middleware = exports.isAppSettingsRoute(route) ? utils.getSettingsMiddlewares() :
            utils.getRequestMiddlewares();

        if (method == "get") {
            app.get(route, middleware, fn)
        }
        else if (method == "post") {
            app.post(route, middleware, fn);
        }
//        var methodRoutes = app.routes[method];
//        return methodRoutes[methodRoutes.length - 1];
    };
}
441025
function Router() {
    var resources = {};

    // Public methods
    this.addRoute = function(resource) {
        var mPoint = resource.getMountPoint();

        if (typeof(resources[mPoint]) === 'undefined') {
            resources[mPoint] = resource;
        } else {
            resources[mPoint].update(resource);
        }
    };

    this.dispatch = function(locals) {
        var accept = locals.getAcceptedTypes();
        var request = locals.getRequest();
        var dispatched = false;
        var header;
        var mountPoint;
        var resource;

        locals.updateResponse(404);
        // Iterate over the resources
        for (mountPoint in resources) {
            // Did anybody flush already?
            resource = resources[mountPoint];
            // Does your URL definition matches this path?
            if (resource.matchesURL(request.path)) {
                locals.updateResponse(405);
                // Do you handle this method?
                if (resource.allowsMethod(request.method)) {
                    locals.updateResponse(406);
                    // Do you understand this format?
                    if (resource.acceptsType(accept, request.method)) {
                        locals.updateResponse(200);
                        // It's all yours
                        resource.takeOver(locals);
                        // And we set a flag announcing it was dispatched
                        dispatched = true;
                    }
                } else {
                    header = resource.getMethods().join(', ');
                    locals.getResponse().setHeader('Allow', header);
                }
            }
        }

        // Each resource emits a 'Resource:postRequest' event that flushes
        // the response. If no resource was found, that event was not emitted
        // and we need to do it manually.
        if (!dispatched) {
            locals.emit('Resource:completed');
            locals.emit('Resource:preRequest');
            locals.emit('Resource:postRequest');
        }
    };
}
722773
def map ref,route, options={}
      context = Context.collection[get_context]
      context.routes[ref]= Route.new(route, context,options)
    end
1263920
def route(method, pattern, handler=None):
    
    if handler is None:
        return partial(route, method, pattern)
    return routes.append(method, pattern, handler)
634522
def put(self, path=None, method='PUT', **options):
        
        return self.route(path, method, **options)
946946
function RoutePattern(options) {
    // The route string are compiled to a regexp (if it isn't already)
    this.pathPattern = options.pathPattern;
    this.queryStringPattern = options.queryStringPattern;
    this.hashPattern = options.hashPattern;

    // The original routestring (optional)
    this.routeString = options.routeString;
  }