-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
41 lines (36 loc) · 1.2 KB
/
server.js
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
const express = require('express');
const app = express();
const bodyParser = require('body-parser');
const schedule = require('node-schedule');
const port = process.env.PORT || 3002;
const github = require(__dirname + '/github.js');
const slack = require(__dirname + '/slack.js');
app.use(bodyParser.json());
app.get('/', (req, res) => {
res.json({test:'123'})
});
app.listen(port, ()=>{
console.log(`express is running on ${port}`);
});
slack.init();
//checkDailyCommit();
function checkDailyCommit(){
github.existsTodayCommit(slack.sendMsgSlack);
}
schedule.scheduleJob("0 0 21,23 * * *", function() {
checkDailyCommit();
}
/*
* * * * * *
│ │ │ │ │ │
│ │ │ │ │ └ day of week (0 - 7) (0 or 7 is Sun)
│ │ │ │ └───── month (1 - 12)
│ │ │ └────────── day of month (1 - 31)
│ │ └─────────────── hour (0 - 23)
│ └──────────────────── minute (0 - 59)
└───────────────────────── second (0 - 59, OPTIONAL)
ex)
var scheduler = schedule.scheduleJob("5,30 * * * * *", function() {
console.log('schedule test1');
});
*/