Skip to content
This repository has been archived by the owner on May 19, 2024. It is now read-only.

Commit

Permalink
Added usage
Browse files Browse the repository at this point in the history
  • Loading branch information
nblackburn committed Aug 21, 2016
1 parent 509f1a6 commit 1e9c9aa
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ Once you have installed micro match, simply include it in your project like so..
const match = require('micro-match');
```

## Usage

micro match exposes a single method which allows you to match a route binding to it's real world counterpart and return it's bindings.

```javascript
const {id} = match('/users/:id', '/users/1');
```
Parameters are defined as a comma followed by an alias to bind it's value to.

You can also create optional parameters by attaching a `?` suffix. This will allow both `/users` and `/users/1` to be matched.

Now you will be able to access the `id` parameter with the value of `1` and handle it however ever you like.

## Changes

Details for each release are documented in the [release notes](CHANGELOG.md).
Expand Down

0 comments on commit 1e9c9aa

Please sign in to comment.