Update remote method example

This commit is contained in:
Ritchie 2013-09-25 10:52:15 -07:00
parent ba5814aeff
commit 6695a338d3
1 changed files with 6 additions and 5 deletions

View File

@ -511,12 +511,13 @@ Expose a remote method.
```js ```js
Product.stats = function(fn) { Product.stats = function(fn) {
var calc = require('./stats'); var statsResult = {
totalPurchased: 123456
};
var err = null;
Product.find(function(err, products) { // callback with an error and the result
var productStats = calc(products); fn(err, statsResult);
fn(null, productStats);
});
} }
loopback.remoteMethod( loopback.remoteMethod(