Permalink
Browse files

trying to figure out GitHub Markdown...

  • Loading branch information...
1 parent 3b1b843 commit 87f2fb572d853db116fa275e5ec6927d12049131 @kieran committed Jun 25, 2011
Showing with 9 additions and 1 deletion.
  1. +9 −1 Readme.md
View
@@ -20,6 +20,7 @@ var router = new Router;
### Adding routes
+
```javascript
// a basic example
router.match( '/products', 'GET' )
@@ -46,6 +47,7 @@ router.post( '/products' )
router.delete( '/products' )
.to( 'products.destroy' )
```
+
### REST Resources
```javascript
@@ -80,19 +82,22 @@ router.delete('/products/:id(.:format)' )
Resolution & dispatching
------------------------
-The `router.all( url, method [, callback] )` method can be used in two ways:
+The `router.first( url, method [, callback] )` method can be used in two ways:
```javascript
var params = router.first( '/products/15', 'GET' )
```
+
OR
+
```javascript
router.first( '/products/15', 'GET', function( params ){
// dispatch the request or something
})
```
You can get all the matching routes like so:
+
```javascript
var params = router.all( '/products/15', 'GET' )
@@ -103,6 +108,7 @@ Route generation
----------------
Pass in a params hash, get back a tasty string:
+
```javascript
router.url( {
controller: 'products',
@@ -119,8 +125,10 @@ router.url( {
} )
//=> '/products/5.json'
```
+
Set the optional second parameter to `true` if you want
extra params appended as a query string:
+
```javascript
router.url({
controller: 'products',

0 comments on commit 87f2fb5

Please sign in to comment.