2014-02-19 19:44:16 +00:00
|
|
|
var loopback = require('../../');
|
|
|
|
var client = loopback();
|
|
|
|
var CartItem = require('./models').CartItem;
|
|
|
|
var remote = loopback.createDataSource({
|
|
|
|
connector: loopback.Remote,
|
2016-04-01 09:14:26 +00:00
|
|
|
url: 'http://localhost:3000',
|
2014-02-19 19:44:16 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
client.model(CartItem);
|
|
|
|
CartItem.attachTo(remote);
|
|
|
|
|
|
|
|
// call the remote method
|
|
|
|
CartItem.sum(1, function(err, total) {
|
|
|
|
console.log('result:', err || total);
|
|
|
|
});
|
|
|
|
|
|
|
|
// call a built in remote method
|
|
|
|
CartItem.find(function(err, items) {
|
|
|
|
console.log(items);
|
|
|
|
});
|