Browse Source

test error

nameczz 3 years ago
parent
commit
fe8a7ec6eb
1 changed files with 15 additions and 28 deletions
  1. 15 28
      checkInsight.js

+ 15 - 28
checkInsight.js

@@ -3,32 +3,19 @@ const axios = require('axios');
 const BASE_URL = process.env.INSIGHT_URL;
 const BASE_URL = process.env.INSIGHT_URL;
 console.log('---- check start ----- ', BASE_URL);
 console.log('---- check start ----- ', BASE_URL);
 
 
-axios
-  .get(`${BASE_URL}/api/v1/asd`)
-  .then(res => {
-    console.log(res.data);
-    if (res.data.statusCode === 200) {
-      console.log('---- Server OK -----');
-    } else {
-      throw new Error('');
-    }
-  })
-  .then(err => {
-    console.log('---- Server has some error ----');
-    process.exit();
-  });
+axios.get(`${BASE_URL}/api/v1/asd`).then(res => {
+  if (res.data.statusCode === 200) {
+    console.log('---- Server OK -----');
+  } else {
+    throw new Error('---- Server has some error ----');
+  }
+});
 
 
-axios
-  .get(`${BASE_URL}/connect`)
-  .then(res => {
-    // if return statusCode mean it's failed. Otherwise it will return html
-    if (res.data.includes('<html')) {
-      console.log('---- Client OK -----');
-    } else {
-      throw new Error('---- Client has some error ----');
-    }
-  })
-  .catch(err => {
-    console.log('---- Client has some error ----');
-    process.exit();
-  });
+axios.get(`${BASE_URL}/connect`).then(res => {
+  // if return statusCode mean it's failed. Otherwise it will return html
+  if (res.data.includes('<html')) {
+    console.log('---- Client OK -----');
+  } else {
+    throw new Error('---- Client has some error ----');
+  }
+});