From 6695a338d3c025d1bfc9a7d3a3516aa4f2431859 Mon Sep 17 00:00:00 2001 From: Ritchie Date: Wed, 25 Sep 2013 10:52:15 -0700 Subject: [PATCH] Update remote method example --- docs/api.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/api.md b/docs/api.md index 5cf8fd13..f7d16ece 100644 --- a/docs/api.md +++ b/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(