Skip to content

Instantly share code, notes, and snippets.

@fanda
Forked from Marak/isTheWebsiteDown.js
Last active August 29, 2015 14:13
Show Gist options
  • Save fanda/4b4e97fc6d153e1ce794 to your computer and use it in GitHub Desktop.
Save fanda/4b4e97fc6d153e1ce794 to your computer and use it in GitHub Desktop.
Checks to see if a website is down
var http = require('http');
module['exports'] = function pingWebsite (hook) {
var sites = [
'http://trikoko.herokuapp.com',
'http://www.fitcor.cz',
'http://www.vystavuj.cz'
];
for(url in sites) {
http.get(url, function(res){
hook.res.end('false');
}).on('error', function (){
hook.res.end('true');
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment