OptimalBits/redbird — pull request #8 by tcoats (2014-10-14 02:27:46+00:00)
Title: Register and proxy to a custom function

Logging requests, checking permissions and other use cases require a custom function for every request going through redbird. This pull request adds the following syntax:

```js
redbird.register('example.com', function(req, res, proxy) {
proxy.web(req, res, {target: 'http://192.168.1.2:8080/'});
});
```
Which is equivalent to:
```js
redbird.register('example.com', '192.168.1.2:8080');
```

However with the new syntax we are able to return a 404, perform permission checking or proxy to a different url per request.

Internally the array is still called urls, which is something I can cleanup if needed. Also the readme should probably be updated with this new syntax. I'm happy to do both of these if this is a piece of functionality that is welcome in redbird. At the moment there is no parameter to access any options set for the route which may be an addition we want to consider.

Let me know what you think.