I am trying to execute a function every hour. This essentially validates documents from a MonoDB. However, at time of first interval the application crashes throwing the following error:
timers.js:252
callback.apply(this, args);
^
TypeError: Cannot call method 'apply' of undefined
at wrapper [as _onTimeout] (timers.js:252:14)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
Here are snippets from my files:
validator
function validate() { ... }
module.exports = {
validate : validate
}
www
var validator = require('../lib/validator');
var app = require('../app');
app.listen(3000, function() {
setInterval(validator.validate(), 360000);
}