I'm trying run a simple app that checks the status of a URL using the http server module.
Basically this is the simple http server:
require('http').createServer(function(req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.end('URL is OK');
}).listen(4000);
Now within that I want to check the status of the URL using this section:
var request = require('request');
request('http://www.google.com', function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log("URL is OK") // Print the google web page.
}
})
So basically I want to launch node , open a browser and display content with text saying "URL is OK". Then to refresh every 10 mins.
Any help is greatly appreciated.