I am trying to write a Loopback remote method that will return my model's json configuration file "property.json" from this directory:
Currently what I am trying is that:
Sync.getSDKData = function(cb){
console.log("getSDKData called!");
cb(null, "../common/models/property.json");
}
Sync.remoteMethod (
'getSDKData',
{
http: {path: '/getSDKData', verb: 'get'},
accepts: { },
returns: {
arg: 'data',
type: 'object',
root: true
}
}
);
Well, your code is literally just returning a string. You want to use the fs package to read in the file contents and then return that instead.