-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
executable file
·64 lines (55 loc) · 1.65 KB
/
app.js
File metadata and controls
executable file
·64 lines (55 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
'use strict';
/**
* Module dependencies.
*/
var express = require('express');
var fs = require('fs');
var httpRequest = require('request');
/**
* Main application entry file.
* Please note that the order of loading is important.
*/
// Load Configurations
var config = require('./config/config');
var winston = require('./config/winston');
winston.info('Starting '+config.app.name+'...');
winston.info('Config loaded: '+config.NODE_ENV);
winston.debug('Accepted Config:',config);
var db = require('./config/sequelize');
var passport = require('./config/passport');
var app = express();
//Initialize Express
require('./config/express')(app, passport);
//Start the app by listening on <port>
app.listen(config.PORT);
winston.info('Express app started on port ' + config.PORT);
var schedule = require('node-schedule');
let cron15 = schedule.scheduleJob('0 */15 * * * *', function(){
var post = {
url : 'http://127.0.0.1:3009/api/cron/check/1',
method : 'GET',
}
httpRequest(post, function(err, r, b) {
console.log('cron15',b);
});
});
let cronHourly = schedule.scheduleJob('0 0 */1 * * *', function(){
var post = {
url : 'http://127.0.0.1:3009/api/cron/check/2',
method : 'GET',
}
httpRequest(post, function(err, r, b) {
console.log('cronHourly',b);
});
});
let cronDaily = schedule.scheduleJob('0 0 0 */1 * *', function(){
var post = {
url : 'http://127.0.0.1:3009/api/cron/check/3',
method : 'GET',
}
httpRequest(post, function(err, r, b) {
console.log('cronDaily',b);
});
});
//expose app
module.exports = app;