Posts

Showing posts from January, 2018

Promise method of Node JS and how it simplifies the callback problem

Hi guys,Today we will see how  we can avoid callback problems by Advanced method of node Provided by Node version 6.5.0 (or further version). Its Promise method.You don't need to include any library for that.Below  is the example. function asyncJobFunction() { var url="mydomain.com"; return new Promise(function(resolve,reject){ //Write here your Async Code call.Get(url,function(err,data) { if(err) { reject(err); ///Reject the Promise by calling the reject method. } else { console.log("Success"); resolve(data); ///Resolve the Promise by calling the resolve method. } }) }) } above we have written one function asyncJobFunction which returns the promise object.so we have to catch the result either resolve or reject. lets see how we can catch that. var promiseData=asyncJobFunction();  promiseData.then(function(result){ console.log("Success"); console.log(result);  /...

File Upload and Send it Through AJAX to node.js Server in SAPUI5 Application

Hi team, Today,In this post I will be explaining you how to upload any types of file in SAPui5 application. Actually you will find many techniques over a web for file upload in sapui5.But those techniques will be related to directly passing the media server or gateway server which can store(upload) the file content and also have downlloadable feature. What if you dont have any server and you are also not going to deploy the sapui5 application to fiori sandbox or sap abap sever.In that case you cant buy server just for media upload. So Only way possible is convert the file in base64 format and send it like normal string to server over ajax and store in database or in text file in server and also again use that base64  format to get the actual data back in the actual format. Here i will explain it for sapui5 application and will send to node.js server but it can be used for any Javascript framework just you need to have your uploaded which accepts file from our devices w...