mg2017
10/07/2019, 10:39 AMns_dev
10/07/2019, 10:50 AM{ success: true, data: SUCCES_DATA }
or { success: false, error: ERROR_REASON }
Note: 1. Use try-catch block
2. check request type before returning. i.e check typeof requets object, if it is JSON, your return format should be the samemg2017
10/07/2019, 11:49 AMmg2017
10/07/2019, 11:49 AMns_dev
10/07/2019, 11:51 AMmg2017
10/07/2019, 12:08 PMmg2017
10/07/2019, 12:08 PMns_dev
10/07/2019, 12:10 PMreturn typeof restletBody === 'string'
? JSON.stringify(successObj)
: successObj;
where restletBody is your request objectns_dev
10/07/2019, 12:11 PMmg2017
10/07/2019, 1:50 PM