-
-
Save breandan/bf58903dda06f50bd63a to your computer and use it in GitHub Desktop.
Checks to see if a website is down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
module['exports'] = function isTheWebSiteDown (hook) { | |
http.get(hook.params.url, function(res){ | |
hook.debug(hook.params.url + " is up and running.") | |
hook.res.end('false'); | |
}).on('error', function (){ | |
hook.debug(hook.params.url + " is DOWN!") | |
hook.res.end('true'); | |
}); | |
}; | |
module['exports'].schema = { | |
"url": { | |
"type": "string", | |
"default": "http://google.com" | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment