visionmedia/express — Issue #861: app.match / app.lookup return Objects, not Functions
Author: bminer
Created: 2011-10-10 01:03:53+00:00
State: open

app.match and app.lookup functions do NOT match API description. For example, if you call `app.lookup.get("/foo");`, it will return an array of Objects, not an array of Functions, as described.

Example:
```javascript
var express = require("express");
var app = express.createServer();

app.get("/foo", function(req, res) {
res.json({'hello': 'world'});
});
app.get("/bar", function(req, res) {
res.json({'hello': 'bar'});
});
var test = app.lookup.get("/foo");
console.log(test[0]);
console.log(typeof test[0]);
console.log(test[0].callbacks[0].toString() );
```
Will output:
```
{ path: '/foo',
method: 'get',
callbacks: [ [Function] ],
keys: [],
regexp: /^\/foo\/?$/i }
object
function (req, res) {
res.json({'hello': 'world'});
}
```