var express = require('express'),
    app = express(),
    q = require('q'),
    config = require('./config');

var controllers = require('./controllers'),
    scrape = require('./scrape');

app.set('views', './views');
app.set('view engine', 'jade');

app.use('/static', express.static(__dirname + '/static'));
app.use(controllers)

app.listen(3000);

// check database

function scrapeLoop () {
    if (config.scraper && config.scraper.interval) {
        scrape();
        setTimeout(scrapeLoop, config.scraper.interval);
    }
}

scrapeLoop();
@@ -106,14 +106,65 @@
 ig')
-;%0A%0Avar
+,%0A    glob = require('glob'),%0A    fs = require('fs'),%0A   
  con
@@ -401,52 +401,290 @@
 );%0A%0A
-// check database%0A%0Afunction scrapeLoop () %7B%0A
+function clearLogs () %7B%0A    glob('logs/**/*.log', function (err, files) %7B%0A        if (!err) %7B%0A            files.forEach(function(file) %7B%0A                fs.unlink(file);%0A            %7D);%0A        %7D%0A    %7D);%0A%7D%0A%0Afunction scrapeLoop () %7B%0A    clearLogs();%0A    setTimeout(function () %7B%0A    
     
@@ -736,24 +736,28 @@
 ) %7B%0A        
+ 
+   
 scrape();%0A  
@@ -750,24 +750,28 @@
   scrape();%0A
+    
         setT
@@ -819,17 +819,35 @@
 l);%0A    
+ 
-%7D
+   %7D%0A    %7D, 1000);
 %0A%7D%0A%0Ascra

clear logs on scrape loop