Skip to content

Commit

Permalink
[skip-ci] Update README with API
Browse files Browse the repository at this point in the history
  • Loading branch information
Vijar committed Jan 27, 2015
1 parent 0c9e739 commit 7fb6352
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.md
Expand Up @@ -82,6 +82,35 @@ Command-line example:
$ browserify index.js -t [ envify --NODE_ENV production ] | uglifyjs -c > bundle.js
```

[//]: # (API_START)
## Routr API

### Constructor(routes)

Creates a new fetchr plugin instance with the following parameters:

* `routes` (optional): Route table, which is a name to router config map.

### Instance Methods

#### getRoute(url, options)

Returns the matched route info if path/method/navigate.params matches to a route; null otherwise.

* `url` (required) The url to be used for route matching. Query strings are **not** considered when performing the match.
* `options` (required) options object
* `options.method` (optional) The case-insensitive HTTP method string. DEFAULT: 'get'
* `options.navigate` (required) The navigation info.
* `options.navigate.type` (required) The navigation type: 'pageload', 'click', 'popstate'.
* `options.navigate.params` (optional) The navigation params (that are not part of the path).

#### makePath(name, params)

Generates a path string with the route with the given name, using the specified params.

* `name` (required) The route name
* `options` (required) The route parameters to be used to create the path string
[//]: # (API_STOP)

## License

Expand Down

0 comments on commit 7fb6352

Please sign in to comment.