Lines Matching refs:path
48 @param {String} [config.root=''] Root path from which all routes should be
104 should only match a single level of a path, or `*` for splat parameters
105 that should match any number of path levels.
126 Regex that matches everything before the path portion of a URL (the origin).
128 only want the path.
210 Gets the current route path, relative to the `root` (if any).
213 @return {String} Current route path.
241 Returns an array of route objects that match the specified URL path.
244 path whenever the URL changes. You may override it if you want to customize
252 the route's path specification, if any.
253 * `path`: The route's path specification, which may be either a string or
255 * `regex`: A regular expression version of the route's path specification.
256 This regex is used to determine whether the route matches a given path.
261 // => [{callback: ..., keys: [], path: '/foo', regex: ...}]
264 @param {String} path URL path to match.
265 @return {Object[]} Array of route objects that match the specified path.
267 match: function (path) {
269 return path.search(route.regex) > -1;
275 the result. The returned path will always have a leading `/`.
279 @return {String} Rootless path.
284 // Strip out the non-path part of the URL, if any (e.g.
285 // "http://foo.com"), so that we're left with just the path.
309 router.replace('/path/');
310 // New URL: http://example.com/path/
312 router.replace('/path?foo=bar');
313 // New URL: http://example.com/path?foo=bar
334 part of a URL path (not including `/` characters), and `*param` will match
335 any number of parts of a URL path (including `/` characters). These named
349 * Route: `/file/*path`
350 * URL: `/file/foo/bar/baz.txt`, params: `{path: 'foo/bar/baz.txt'}`
351 * URL: `/file/foo`, params: `{path: 'foo'}`
364 @param {String|RegExp} path Path to match. May be a string or a regular
372 the route path specification. If a string path was used and contained
374 names to their matched values. If a regex path was used, this will be
377 @param {String} callback.req.path The current URL path.
398 route: function (path, callback) {
404 path : path,
405 regex : this._getRegex(path, keys)
425 router.save('/path/');
426 // New URL: http://example.com/path/
428 router.save('/path?foo=bar');
429 // New URL: http://example.com/path?foo=bar
461 // This is an HTML5 browser and we have a hash-based path in the
526 @param {String} path URL path.
532 _dispatch: function (path, url, src) {
534 routes = self.match(path),
544 req = self._getRequest(path, url, src);
553 matches = route.regex.exec(path);
557 // Use named keys for parameter names if the route path contains
576 Gets the current path from the location hash, or an empty string if the
580 @return {String} Current hash path, or an empty string if the hash is empty.
603 Gets the current route path, relative to the `root` (if any).
606 @return {String} Current route path.
610 var path = (!this._html5 && this._getHashPath()) ||
613 return this.removeRoot(path);
642 @param {String|RegExp} path Route path specification.
648 _getRegex: function (path, keys) {
649 if (path instanceof RegExp) {
650 return path;
654 if (path === '*') {
658 path = path.replace(this._regexPathParam, function (match, operator, key) {
660 // in-path wildcards like: '/foo/*'.
669 return new RegExp('^' + path + '$');
676 @param {String} path Current path being dispatched.
682 _getRequest: function (path, url, src) {
684 path : path,
736 All host or path relative URLs are of the same origin. A scheme-relative URL
920 this.route(route.path, route.callback);
996 Absolute root path from which all routes should be evaluated.
999 `http://example.com/myapp/` and you add a route with the path `/`, your
1000 route will never execute, because the path will always be preceded by
1018 * `path`: String or regex representing the path to match. See the docs