Can someone explain how this works, I have tried passing the data from my own server and send it to mysql. but my next task is to pass the json object to another serve using http post method
here is the link: http://docs.strongloop.com/display/DOC/Remote+methods+and+hooks
i can't seem to understand where to put this sample codes and recode it.
i'm also trying to pass the data. i edited my app.js
here is what i added.
var Users = app.model.userRegistrations;
Users.count = function(fn) {
var usercount = {
count: 123456
};
var err = null;
// callback with an error and the result
fn(err, usercount);
}
loopback.remoteMethod(
Product.count,
{
returns: {arg: 'count', type: 'object'},
http: {path: 'http://192.168.45.85:90', verb: 'get'}
}
);
but i got an error
events.js:72
throw er; // Unhandled 'error' event
^
TypeError: Cannot set property 'count' of undefined
at Object.<anonymous> (/home/tsuper/supertsuper/app.js:15:13)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Object.<anonymous> (/usr/local/lib/node_modules/strong-supervisor/bin/slr:27:19)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
is it correct that i put this codes in the app.js?
my goal is . after sending a data from my loopback. the loopback will also pass it to another server post method json data.