Skip to content
Browse files

"delete" needs to be "del" since the convenience methods should be ab…

…le to stand alone (damn keywords) - version bump
  • Loading branch information...
1 parent 99aa221 commit b80e00370decfef38f2337c5d292030b47af109c @kieran committed Aug 14, 2011
Showing with 8 additions and 8 deletions.
  1. +2 −2 Readme.md
  2. +4 −4 lib/router.js
  3. +1 −1 package.json
  4. +1 −1 tests/barista.test.js
View
4 Readme.md
@@ -97,7 +97,7 @@ router.put( '/products/:id(.:format)' )
router.post( '/products' )
.to( 'products.create' )
-router.delete( '/products' )
+router.del( '/products' )
.to( 'products.destroy' )
```
@@ -128,7 +128,7 @@ router.post('/products(.:format)' )
router.put('/products/:id(.:format)' )
.to( 'products.update' )
-router.delete('/products/:id(.:format)' )
+router.del('/products/:id(.:format)' )
.to( 'products.destroy' )
```
View
8 lib/router.js
@@ -37,7 +37,7 @@ var Router = function() {
if ( typeof path != 'string' ) throw 'path must be a string'
- if ( typeof method != 'undefined' && !METHODS.test(method)) throw 'method must be one of: get, post, put, delete'
+ if ( typeof method != 'undefined' && !METHODS.test(method)) throw 'method must be one of: GET, POST, PUT, DELETE'
var route = new Route(path, method)
self.routes.push(route)
@@ -69,11 +69,11 @@ var Router = function() {
this.post = function( path ){
return self.match(path, 'POST')
}
- // ### router.delete( path )
+ // ### router.del( path )
// equivalent to
//
// router.match( path, 'DELETE' )
- this.delete = function( path ){
+ this.del = function( path ){
return self.match(path, 'DELETE')
}
@@ -93,7 +93,7 @@ var Router = function() {
self.get('/'+controller_slug+'/:id/edit(.:format)', 'GET').to(controller+'.edit'),
self.post('/'+controller_slug+'(.:format)', 'POST').to(controller+'.create'),
self.put('/'+controller_slug+'/:id(.:format)', 'PUT').to(controller+'.update'),
- self.delete('/'+controller_slug+'/:id(.:format)', 'DELETE').to(controller+'.destroy')
+ self.del('/'+controller_slug+'/:id(.:format)', 'DELETE').to(controller+'.destroy')
];
};
View
2 package.json
@@ -1,7 +1,7 @@
{
"name": "barista",
"description": "URL router & generator, similar to Rails / merb",
- "version": "0.0.3",
+ "version": "0.0.4",
"author": "Kieran Huggins <kieran@kieran.ca>",
"repository": "git://github.com/kieran/barista",
"main": "./index.js",
View
2 tests/barista.test.js
@@ -405,7 +405,7 @@ RouterTests = {
},
'test DELETE Shorthand' : function() {
- var route = router.delete('/:controller/:action(/:id)(.:format)');
+ var route = router.del('/:controller/:action(/:id)(.:format)');
var params = router.first('/products/show/1.html','DELETE');
assert.ok(params, this.fail);
assert.equal(params.method, 'DELETE', this.fail);

0 comments on commit b80e003

Please sign in to comment.
Something went wrong with that request. Please try again.