can you please give more context on what you are passing on to the SMI method?
and are you passing it from Iparams or from the app?
can you please specify some code samples here for more clarity?
@Santhosh, thank you!
** I just tried passing this sample function. and calling it on page load… after the app initialize**
function getphone() {
var options = { "url": "https://api.github.com/users/sample" };
client.request.invoke("serverMethod", options).then(
function(data) {
// data is a json object with requestID and response.
// data.response gives the output sent as the second argument in renderData.
console.log("server method Request ID is: " + data.requestID);
console.log("server method response is: " + data.response);
},
function(err) {
// err is a json object with requestID, status and message.
console.log("Request ID: " + err.requestID);
console.log("error status: " + err.status);
console.log("error message: " + err.message);
});
}
**and exported data on server.js file as**
exports = {
serverMethod: function(options) {
// write your code here.
// an additional key , iparam (containing account configs) will be attached to the options.
// use renderData ( err, data ) to send back the response.
renderData(null, { "key": "value" });
}
}
@Raghul_Kumar,
Good Day!
The code you posted seems to be fine, possible can you please share your app zip / paste the actual code which you are trying to execute in app.js and server.js
so that we are able to find the exact root cause.
@Raghul_Kumar,
I had verified your app and there seems to be some issue in your folder structure,
your current folder structure is like this
SIM_TEST -> app -> scripts -> app.js, server.js
but the expected folder structure will be for app.js
SIM_TEST -> app -> app.js for server.js
SIM_TEST -> server -> server.js
for more reference please visit our sample app repo or sample serverless app template