瀏覽代碼

Return meaningful response

jmacura 5 年之前
父節點
當前提交
07ee2a05fb
共有 1 個文件被更改,包括 2 次插入4 次删除
  1. 2 4
      index.js

+ 2 - 4
index.js

@@ -132,10 +132,8 @@ app.get('/runR', (req, res, next) => {
         function(err, data) {
             console.log('R done');
             if (err) console.log(err.toString('utf8'))
-            else {
-							console.log(data);
-              data = {result: 'R call succesful'};
-						}
+            else console.log(data);
+            if (!data) data = {result: 'R call succesful'}
             helpers.formatResponse({ response: data }, req, res);
         }
     );