Skip to content

Instantly share code, notes, and snippets.

@shuhblam
Created August 6, 2011 21:50
Show Gist options
  • Save shuhblam/1129783 to your computer and use it in GitHub Desktop.
Save shuhblam/1129783 to your computer and use it in GitHub Desktop.
node setInterval
var fs = require('fs');
var http = require('http');
var server = http.createServer(function(req, response){
setInterval ( fetchMedia, 2000 );
fs.readFile(__dirname+'/index.html', function(err, data){
response.writeHead(200, {'Content-Type':'text/html'});
response.write(data);
response.end();
});
});
server.listen(3000);
var fetchMedia = function(){
console.log('fetching media');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment