Update remote method example
This commit is contained in:
parent
ba5814aeff
commit
6695a338d3
11
docs/api.md
11
docs/api.md
|
@ -511,12 +511,13 @@ Expose a remote method.
|
|||
|
||||
```js
|
||||
Product.stats = function(fn) {
|
||||
var calc = require('./stats');
|
||||
var statsResult = {
|
||||
totalPurchased: 123456
|
||||
};
|
||||
var err = null;
|
||||
|
||||
Product.find(function(err, products) {
|
||||
var productStats = calc(products);
|
||||
fn(null, productStats);
|
||||
});
|
||||
// callback with an error and the result
|
||||
fn(err, statsResult);
|
||||
}
|
||||
|
||||
loopback.remoteMethod(
|
||||
|
|
Loading…
Reference in New Issue