Skip to content

Instantly share code, notes, and snippets.

@Marak
Last active September 24, 2015 14:06
Show Gist options
  • Save Marak/95403b36b297d5e6bdb0 to your computer and use it in GitHub Desktop.
Save Marak/95403b36b297d5e6bdb0 to your computer and use it in GitHub Desktop.
Checks to see if a website is down
module['exports'] = function isTheWebSiteDown (hook) {
var http = require('http');
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