From 3527ded36ffe0514a1fae29b55d442232c050dfb Mon Sep 17 00:00:00 2001 From: supositware Date: Tue, 16 Mar 2021 16:18:51 +0100 Subject: [PATCH] check hapi server status --- utils/checkHapi.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 utils/checkHapi.js diff --git a/utils/checkHapi.js b/utils/checkHapi.js new file mode 100644 index 0000000..c2439aa --- /dev/null +++ b/utils/checkHapi.js @@ -0,0 +1,10 @@ +const fetch = require('node-fetch'); +const { Hapi } = require('../config.json'); + +module.exports = async function () { + if (Hapi) { + var res = await fetch(Hapi); + return res.status === 200; + } else + return false; +}; \ No newline at end of file