Comparing version 1.0.8 to 1.0.9
@@ -1,2 +0,1 @@ | ||
var events = require('events'), | ||
@@ -77,3 +76,4 @@ qs = require('querystring'), | ||
var method = req.method === 'HEAD' ? 'get' : req.method.toLowerCase(), | ||
fns = this.traverse(method, req.url, this.routes, ''), | ||
url = req.url.split("?", 1)[0], | ||
fns = this.traverse(method, url, this.routes, ''), | ||
thisArg = { req: req, res: res }, | ||
@@ -80,0 +80,0 @@ self = this, |
@@ -335,4 +335,7 @@ /* | ||
if (this.async) { | ||
_asyncEverySeries(fns, function (fn, next) { | ||
if (typeof fn == 'function') { | ||
_asyncEverySeries(fns, function apply(fn, next) { | ||
if (Array.isArray(fn)) { | ||
return _asyncEverySeries(fn, apply, next); | ||
} | ||
else if (typeof fn == 'function') { | ||
fn.apply(thisArg, fns.captures.concat(next)); | ||
@@ -339,0 +342,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"author": "Nodejitsu Inc <info@nodejitsu.com>", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"maintainers": [ "hij1nx <hij1nx@me.com>", "indexzero <charlie.robbins@gmail.com>" ], | ||
@@ -21,5 +21,4 @@ "contributors": [ | ||
"colors": "0.5.x", | ||
"eyes": "0.1.x", | ||
"uglify-js": "1.0.6", | ||
"request": "2.0.x", | ||
"request": "2.9.x", | ||
"vows": "0.6.x" | ||
@@ -33,2 +32,3 @@ }, | ||
} | ||
} | ||
} | ||
@@ -34,10 +34,13 @@ # Director [![Build Status](https://secure.travis-ci.org/flatiron/director.png)](http://travis-ci.org/flatiron/director) | ||
var author = function () { /* ... */ }, | ||
books = function () { /* ... */ }; | ||
books = function () { /* ... */ }, | ||
viewBook = function(bookId) { /* bookId is populated. */ }; | ||
var routes = { | ||
'/author': showAuthorInfo, | ||
'/books': [showAuthorInfo, listBooks] | ||
'/author': author, | ||
'/books': [books, function() { /* An inline route handler. */ }], | ||
'/books/view/:bookId': viewBook | ||
}; | ||
var router = Router(routes); | ||
router.init(); | ||
@@ -91,2 +94,3 @@ </script> | ||
}); | ||
router.init(); | ||
@@ -102,3 +106,3 @@ </script> | ||
You can find a browser-specific build of `director` [here][0] which has all of the server code stripped away. | ||
You can find a browser-specific build of `director` [here][1] which has all of the server code stripped away. | ||
@@ -135,3 +139,3 @@ <a name="http-routing"></a> | ||
// | ||
// stup a server and when there is a request, dispatch the | ||
// setup a server and when there is a request, dispatch the | ||
// route that was requestd in the request object. | ||
@@ -178,4 +182,16 @@ // | ||
}); | ||
// You will need to dispatch the cli arguments yourself | ||
router.dispatch('on', process.argv.slice(2).join(' ')); | ||
``` | ||
Using the cli router, you can dispatch commands by passing them as a string. For example, if this example is in a file called `foo.js`: | ||
``` bash | ||
$ node foo.js create | ||
create something | ||
$ node foo.js destroy | ||
destroy something | ||
``` | ||
<a name="api-documentation"></a> | ||
@@ -656,2 +672,2 @@ # API Documentation | ||
[0]: http://github.com/flatiron/director | ||
[1]: https://github.com/flatiron/director/blob/master/build/director-1.0.7.min.js |
@@ -11,3 +11,2 @@ /* | ||
vows = require('vows'), | ||
eyes = require('eyes'), | ||
director = require('../../../lib/director'); | ||
@@ -14,0 +13,0 @@ |
@@ -11,3 +11,2 @@ /* | ||
vows = require('vows'), | ||
eyes = require('eyes'), | ||
director = require('../../../lib/director'); | ||
@@ -40,2 +39,3 @@ | ||
} | ||
}).export(module); | ||
}).export(module); | ||
@@ -11,3 +11,2 @@ /* | ||
vows = require('vows'), | ||
eyes = require('eyes'), | ||
director = require('../../../lib/director'); | ||
@@ -14,0 +13,0 @@ |
@@ -11,3 +11,2 @@ /* | ||
vows = require('vows'), | ||
eyes = require('eyes'), | ||
director = require('../../../lib/director'); | ||
@@ -14,0 +13,0 @@ |
@@ -11,3 +11,2 @@ /* | ||
vows = require('vows'), | ||
eyes = require('eyes'), | ||
director = require('../../../lib/director'); | ||
@@ -14,0 +13,0 @@ |
@@ -71,3 +71,4 @@ /* | ||
"a request to foo/update/bark": assertGet('foo/update/bark'), | ||
"a request to bar/bazz/bark": assertGet('bar/bazz/bark') | ||
"a request to bar/bazz/bark": assertGet('bar/bazz/bark'), | ||
"a request to foo/bar/bark?test=test": assertGet('foo/bar/bark?test=test') | ||
} | ||
@@ -74,0 +75,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
238013
5
3767
668