Skip to content

Instantly share code, notes, and snippets.

@lodestone
Forked from Marak/isTheWebsiteDown.js
Last active August 29, 2015 14:08
Show Gist options
  • Save lodestone/4c870821f7a96ec28308 to your computer and use it in GitHub Desktop.
Save lodestone/4c870821f7a96ec28308 to your computer and use it in GitHub Desktop.
Checks to see if a website is down
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://wrd.fr"
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment