feathersjs/feathers-hooks — pull request #6 by marshallswain (2014-06-23 01:20:50+00:00)
Title: Fixing errors in custom routes containing queries.

This route...

```js
app.post('/login', function(req, res){
app.lookup('api/users').find({}, function(error, users){
return res.json(users);
});
});
```

results in this error...
```
TypeError: Cannot call method 'call' of undefined
at Object.result.(anonymous function) (/Users/marshallthompson/Sites/ftest/node_modules/feathers-hooks/lib/before.js:40:32)
```

I noticed that only in this type of scenario the hook var is undefined, so I put in a basic check to handle it.

If you remove the app.lookup query, it runs just fine. This doesn't cause any effect on service communications using socket.io or rest, but it might not be the best way to fix this...